[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Hibernate deleting association.

novahokie do-not-reply at jboss.com
Fri Apr 17 15:32:35 EDT 2009

Is it possible for hibernate to delete an association object by specifying some cascade option.

I have Object A with a collection of Object B mapped by OneToMany.

I am removing objects from A by doing.
a.getBs().remove(someObject) and I would like someObject to be deleted
from the DB when I save the A object with saveOrUpdate().  Is it possible to do this or do i need to then manually delete someObject with session.delete(someObject)?

I am using CascadeType.ALL so that when i call a.getBs.add(new B()) then the new B is saved.

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

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

More information about the jboss-user mailing list