[jboss-user] [JBoss Seam] - FlushModeType not working in Seam 1.2.1 GA?

kotlusa do-not-reply at jboss.com
Wed Sep 12 06:51:33 EDT 2007


Environment:
I have tried this in serveral environments...
Seam 1.2.1
JBoss 4.0.5 and 4.2.1
Myfaces (JSF 1.1) and JSF 1.2 RI
Windows XP and Solaris 10
HSQLDB and Oracle

Scenario:
I have a basic situation where I want to edit an entity (and it's related entities on an edit page), go to a confirmation page and let the user either cancel or save their changes.


  |     @Begin(join=true, flushMode=FlushModeType.MANUAL)
  |     public String lookupBlah()
  |     {
  |           //lookup blah....
  |           return "edit";
  |     }
  | 
  |     public String editBlah()
  |     {
  |           em.merge(blah);
  |           return "edit";
  |     }
  | 
  |     @End
  |     public String cancelEdit()
  |     {
  |           return "home";
  |     }
  | 
  |     @End
  |     public String submitEdit()
  |     {
  |           em.flush();
  |           return "home";
  |     }
  | 

The Problem:
Unfortunately, this doesn't work for me.  The  changes are always persisted, even if the user clicks the cancel button.  I am however able to manually tell the em not to flush by putting ((EntityManagerImpl)em.getDelegate()).getSession().setFlushMode(FlushMode.NEVER); at the first line of lookupBlah().

My Questions:
Any idea why setting the FlushModeType in @Begin isn't working?  Does anyone else have it working?  Does my call to the Hibernate Session's setFlushMode method break anything else?

Sidebar/feature request:
It would be great if @End had an optional parameter flush which defaults to true.  This way you wouldn't have to call em.flush.  Also, cancel methods would just have @End(flush=false) or something like that.

Seam Rocks!
Thank you,
Austin

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083366#4083366

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



More information about the jboss-user mailing list