1 Reply Latest reply on Aug 3, 2006 1:01 PM by Eric Ray

    Can't get DELETE_ORPHAN to work with java.persistence.Cascad

    Eric Ray Novice

      I need to annotate a OneToMany relationship like so...

      @OneToMany(mappedBy="remittancePackage", cascade= {CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
      

      However, this does not compile becuse the "cascade" parameter is of type java.persitence.CascadeType. How do I do this?

      I need this behavior...

      If the child object's lifespan is bounded by the lifespan of the parent object, make the parent a full lifecycle object by specifying CascadeType.ALL and org.hibernate.annotations.CascadeType.DELETE_ORPHAN (please refer to the Hibernate reference guide for the semantics of orphan delete)


      And yes, I've read the Hibernate docs. Good for reference but doesn't tell you how to do this in EJB3 with annotations.

      Thanks.
      Eric Ray