-->
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: JPA Unidirectional ManyToMany delete
PostPosted: Thu Jan 24, 2008 6:21 pm 
Newbie

Joined: Thu Jan 24, 2008 5:59 pm
Posts: 2
Hi, I am having trouble deleting an entity in a unidirectional manytomany relationship:

@Entity
class Person{
@Id
String id;
}

@Entity
class Group{
@Id
String id;
@ManyToMany
Set<Person> people;
}

I can add people to groups, but when I em.remove() a person, I am getting an error: Caused by: org.apache.derby.iapi.error.StandardException: DELETE on table 'PERSON' caused a violation of foreign key constraint.

I can solve this by explicitly removing the person from the group before calling em.remove(person), but is there a better way to have this done by the persistence manager?


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.