openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Forcing an Object to be always inserted/updated first during persist/merge
Date Tue, 04 May 2010 22:22:52 GMT

Hi,
  Did you try orphan deleting from the leaf?

  Say A has many B and B has many C and C has many D

  Then some thing like this in A.java

   @OneToMany(...., orphanDelete=true)
   List bs;
   void deleteChildren() {
      for (B b : bs) b.deleteChildren();
      bs = null;
   }

   And in B.java

   @OneToMany(...., orphanDelete=true)
   List<C> cs;
   void deleteChildren() {
      for (C c : cs) c.deleteChildren();
      cs = null;
   }


And then at the application level,

   A a = ...;
  a.deleteChildren();

   

-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Forcing-an-Object-to-be-always-inserted-updated-first-during-persist-merge-tp4990960p5006108.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message