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

damianharvey do-not-reply at jboss.com
Sun Dec 30 10:36:07 EST 2007

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);
  | }


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

More information about the jboss-user mailing list