[jboss-user] [JBoss Seam] - Re: flushMode= MANUAL, when does commit happen? And other qu

enzhao do-not-reply at jboss.com
Thu Jul 12 12:06:30 EDT 2007


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 at 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#4063600

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063600



More information about the jboss-user mailing list