-->
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: How could i delete toAddress entire row in Migration entity?
PostPosted: Wed Nov 13, 2013 6:02 am 
Newbie

Joined: Wed Sep 18, 2013 5:12 am
Posts: 6
say I have two entities like Person and Migration
@entity
class Person{
@id
id
@OneToMany(mappedBy="fromAddress", cascade={CascadeType.REMOVE}, orphanRemoval=true)
private Set<Migration> from = new HashSet<Migration>();

@OneToMany(mappedBy="toAddress", cascade={CascadeType.REMOVE}, orphanRemoval=true)
private Set<Migration> to = new HashSet<Migration>();
}

--
@entity
class Migration{
@Id
id
@ManyToOne
private Person fromAddress;
@ManyToOne
private Person toAddress;
}

when I remove person which is refrenced in fromAddress then child row(Migration row) gets deleted but when Person which is refrenced in toAddress then child row is not deleted, instead toAddress column has null value in it.

How could i delete toAddress entire row in Migration entity?


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.