-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ManyToOne Cascade Question
PostPosted: Fri Oct 02, 2015 10:27 am 
Newbie

Joined: Fri Oct 02, 2015 10:17 am
Posts: 1
I have following mapping:

Code:
@Entity(name="risk")
@Table(name=Schema.S_RIZIKO)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class RiskEntity extends AuditableEntity
{
  private InsuredItemEntity m_insuredItemEntity;

  .....

  @ManyToOne(fetch=FetchType.LAZY)
  @Cascade(org.hibernate.annotations.CascadeType.REPLICATE)
  @JoinColumn(name="ID_PREDMET_ZAV", nullable=true)
  @BatchSize(size=10)
  public InsuredItemEntity getInsuredItemEntity()
  {
    return m_insuredItemEntity;
  }
 
  public void setInsuredItemEntity(InsuredItemEntity insuredItemEntity)
  {
    m_insuredItemEntity = insuredItemEntity;
  } 
}


If i do this

Code:
    RiskEntity riskEntity1 = RiskEntity.get(1318897);  //entityManager.find(entityClass, id);
    InsuredItemEntity insuredItemEntity = riskEntity1.getInsuredItemEntity();
    EntityHelper.deleteEntity(insuredItemEntity);
    .


I get two deletes, one for InsuredItemEntity and one for RiskEntity.
I would expect this to happen if I used CascadeType.ALL.

Am I missing something here or is this a bug ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.