Java Mailing List Archive

http://www.junlu.com/

Home » JBoss User »

[jboss-user] [JBoss Seam] - Re: Oddness -
 javax.persistence.EntityNotFoundException

manik.surtani@jboss.com

2007-12-30


Author LoginPost Reply
I've just run into this problem again and am posting back here so I don't forget again.

When trying to delete an entity that has existing relationships (eg. OneToMany) you have to ensure that you clear the collection before removing the object. eg:public void deleteGroup(Group group) {
|
|  //where the relationship btw a 'User' and a 'Group' is maintained in a 'UserGroupList'
|
|  group.getUserGroupLists().clear();
|  entityManager.remove(group);
| }
Cheers,

Damian.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116092#4116092

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116092
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.