[jboss-user] [EJB 3.0] - Re: ejb3 - setList(Set<MyObjs> list) - fails to persist.

Wolfgang Knauf do-not-reply at jboss.com
Mon Mar 12 13:28:15 EDT 2007


Hi !

I will try to help:
Q1:
If you need only one cascade type value you use the single item notation:
cascade=CascadeType.ALL
You can OR the casace type values:
The following sample will cascade any operation beside a delete (and here you will need the array notation):
cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH} 


Q2: I think you don't need to initialize the relationship field with a value. Set it to null, the container will do the rest.
When you create relationship items you should update both sides of the relationship.
Something like:
myObject.getOwnedItems.add(unsavedNewOwnedItem); 
  | unsavedNewOwnedItem.setObject (myObject); 

Hope this helps 

Wolfgang

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

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



More information about the jboss-user mailing list