2 Replies Latest reply on May 17, 2005 2:59 PM by manica

    OneToMany and CascadeType.ALL

      What is supposed to happen when an item in a OneToMany relationship is removed from the Collection (using CascadeType.ALL)?

      Suppose, Order and LineItems. Remove a LineItem from an Order and call merge. I'm finding that the LineItem is not deleted. In fact, it's foreign key is still pointing to the Order. So, the following (pseudo) code will fail:

      myOrder.getLineItems(myLineItem).remove();
      manager.merge(myOrder);
      manager.refresh(myOrder);
      assertTrue(!myOrder.getLineItems.contains(myLineItem));

      This doesn't seem to be consistent with the typical cascading update functionality.

      Darin