2 Replies Latest reply on Nov 19, 2008 5:09 AM by ravi krishna muthireddy

    delete object from jointable

    ravi krishna muthireddy Newbie

      Hello,
      I am Ramu. I am having a problem with deleting objects from join table (many-to-many) relationship.my code is as follows

      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);
      }

      this.manager.remove(child);

      but it is deleting the child object from parent table also. i want to delete only from join table not from original table . any help appreciated.

      Thank u
      Ramu