2 Replies Latest reply on Mar 17, 2006 1:58 PM by alfonsotames

    In a OneToMany relation, invoking clear() on the collection

    alfonsotames


      I have a OneToMany relation:

      @Entity
      public class Order implements Serializable {
       private List<Product> orderedProducts;
       @OneToMany(cascade=CascadeType.ALL)
       public List<Product> getOrderedProducts() {
       return products;
       }
      }
      


      When i do this:
      Order order = manager.find(Order.class, orderid);
      order.getOrderedProducts().clear();
      


      The products are not deleted from the database, instead their field orderid is updated to null !!!

      Is this normal ?

      Thanks,

      Alfonso Tamés