[jboss-user] [EJB 3.0] - Re: deletion of few elements in one to many collection.
waynebaylor
do-not-reply at jboss.com
Mon Jul 23 13:19:22 EDT 2007
so the Actor objects are removed from the set, but not from the DB, correct?
you have CascadeType.ALL set, which would only delete the Actor objects if you deleted the parent Role object. So, yes, if you also want them removed from the DB you'll have to call em.remove(..); within the for loop.
if you're using Hibernate, another option is to set the Hibernate specific Delete_Orphan cascade type. Then you're Actor objects will automatically be deleted from the DB when you remove them from the parent.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066744#4066744
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066744
More information about the jboss-user
mailing list