[jboss-user] [EJB 3.0] - Re: Deleting parent entity should clear out its foreign key

ColinEberhardt do-not-reply at jboss.com
Mon Mar 19 05:40:41 EDT 2007


Hi,

I would not expect the container to behave as you described. From what I understand, it is the responsibility of the EntityManager and the EJB container to save the state of your managed state Entity beans at the end of the transaction. If you wish your child.category property to be null, then you must manually apply this change in state to all your child entities of the parent category.

Calling em.remove(parent) will remove 'parent' from the database but it will not delete parent the object, your application still holds a reference to it. It's state will be changed from managed to new. You child entities will still maintain a reference to this new state 'parent'

Regards,
Colin E.

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029238



More information about the jboss-user mailing list