1 Reply Latest reply on Oct 7, 2005 7:11 PM by zihong

    Is it possible to remove orphaned children using cascade mer

    zihong

      Is it possible to use CascadeType.Merge, to automatically remove the children that are no longer exist in the latest data graph?


      In specific, I have a example as listed in this link: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=70455

      where there is a OneToMany relationship, and I want to update db with new data. I want to merge the data to db without specifically remove those children no longer exist in the new data.

      Thanks in advance.

      -Zihong

        • 1. Re: Is it possible to remove orphaned children using cascade
          zihong

          After read EJB3 spec backwards couple times (yeah, too many times reading forwards), it seems that EJB3 doesn't requires persistance/merge by reachability. Since the annotation doesn't have the type of CascadeType.DELETE_ORPHAN, which hibernate does (org.hibernate.annotations.CascadeType.DELETE_ORPHAN, separated from cascade type MERGE), I guess merge by reachability is not supported in JBoss' EJB3 server.