I'm writing my first Seam component to update a persistent entity.  Here's the 
code:


  | @Stateless
  | @Scope(ScopeType.EVENT)
  | @Name("accountEditor")
  | public class AccountEditorBean implements AccountEditor {
  | 
  |     @In(required=false)
  |     private AccountManager accountManager;
  |     
  |     @Valid
  |     private Account account;
  |     
  |     @In(create=true)
  |     private Session session;
  |     
  |     public String select() {
  |             account = 
accountManager.getSelectedAccountSummary().getAccount();
  |             return "editAccount";
  |     }
  |     
  |     @IfInvalid(outcome=Outcome.REDISPLAY, refreshEntities=true)
  |     public String update() {
  |             session.update(account);
  |             // NOTE: Without this line uncommented, no database update 
occurs!
  |             //session.flush();
  |             return "home";
  |     }
  |     
  |     public Account getAccount() {
  |             return account;
  |     }
  | }

Note the commented-out line.  When I have the flush() commented out, no 
database updates are happening to account.  When I manually flush in the 
update() method, the database updates occur as I would expect.  Surely, it's 
not intended that I have to manually flush every time I want to update 
something.  Am I just missing something painfully obvious?

I am using Seam 1.0, JBoss 4.0.4, and Hibernate 3.2cr1.  I am using the 
SeamExtendedManagedPersistencePhaseListener.

Any suggestions would be appreciated.

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

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


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to