This content has been marked as final.
Show 2 replies
-
1. Re: delete object from jointable
wolfgangknauf Nov 19, 2008 3:37 AM (in response to mravikrish)Hi,
you mean you want to remove the child from all buyers, but keep the child?
Then your code should be (last two lines are changed):Vendor child = this.manager.getReference(Vendor.class, vendorid ); Collection listParents = child.getBuyers(); Iterator iteratorParents = listParents.iterator(); while (iteratorParents.hasNext() == true) { Buyer parentForChild = iteratorParents.next(); parentForChild.getVendors().remove(child); } //remove ALL buyers from child: listParents.removeAll(); //Now SAVE the child: this.manager.persist(child);
Hope this helps
Wolfgang -
2. Re: delete object from jointable
mravikrish Nov 19, 2008 5:09 AM (in response to mravikrish)Thank u Wolfgang