Hi DG!
Thank you very much for your informative input! In my original post, I was dealing with
the creation of a new motherEntity (which is a complex process...). So the isNew flag
would always be true....However the flag idea is good. I can set a completedOrCanceled
flag. Initialize it as false. The @End methods can be like this:
|
| @End
| public void cancelMotherCreation(){
| // at this point, the children collections may or may not have been filled,
| // but it does not matter, since we can cascade....
| entityManager.remove(motherEntity);
| this.completedOrCanceled = true;
| }
|
| @End
| public void newMotherDone(){
| entityManager.merge(motherEntity);
| this.completedOrCanceled = true;
| }
|
Here the @Destroy method:
| @Destroy@Remove
| public void destroy(){
| if (this.completedOrCanceled == false)
| entityManager.remove(motherEntity);
| }
|
I've got to try it out right now....
Regards,
Ellen
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063600#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...