[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to turn off cascading saving/deleting

j2ee4cxw do-not-reply at jboss.com
Thu Sep 18 16:28:08 EDT 2008

I have a SITE, and a SHIPTYPE table. These two table have a many-to-may relationship (the cross reference table is SHIPTYPE_X_SITE). I created the corresponding entities Site and ShipType. For the creation of ShipType, my UI has ShipType related fields as well as a list of sites. Therefore,ShipType has a collection of Sites:

	private List sites;

and the cross reference records are saved when I save ShipType. That is good.

On the other side, the creation of Site just have some basic Site related fields. There is no list of ShipTYPES in the UI. 

However, I do have the need to retrieve list of ShipTypes associated with a site sometimes. So I added following association to Site entity bean:

	private List shipTypes; 

Once I did that, if I modify  Site and save (collection shipTypes is null), all the cross reference records are gone for the given site. My question is how can I make the Site bean has the association, but not doing the cascading? Thank you very much for you help.

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

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

More information about the jboss-user mailing list