[jboss-user] [EJB 3.0] - Re: Working example por OneToMany cascade remove?

waynebaylor do-not-reply at jboss.com
Fri Aug 10 10:30:43 EDT 2007


i think it's safe to assume that you have the "mappedBy" attribute set for the User side of the relationship, right?

the mappedBy attribute basically says which side of the relationship is responsible for maintaining the DB foreign key link. so, you could try this in your existing code:

  | User[] users = portal.getUsers();
  | for(User user : users)
  | {
  |   user.setPortal(null); //or user.removePortal(), whatever your method is
  | }
  | 
  | em.remove(portal);
  | 


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

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



More information about the jboss-user mailing list