This content has been marked as final.
Show 4 replies
-
1. Re: Can't get database updated without calling flush()
gavin.king Jun 16, 2006 9:39 PM (in response to javajedi)So you have:
<property name="transaction.flush_before_completion">true</property>
in hibernate.cfg.xml?
(Along with all the other settings used in the example app?) -
2. Re: Can't get database updated without calling flush()
javajedi Jun 17, 2006 2:28 AM (in response to javajedi)Yes.
-
3. Re: Can't get database updated without calling flush()
gavin.king Jun 17, 2006 10:09 AM (in response to javajedi)Turn on Hibernate debug logging and check if the afterCompletion phase is running at all.
-
4. Re: Can't get database updated without calling flush()
javajedi Jun 18, 2006 2:15 AM (in response to javajedi)I don't see anything in the logs about afterCompletion. However, I modified my EJB to be stateful with conversation scope, and now the database updates seem to be working. Here is the modified code:
@Stateful @Scope(ScopeType.CONVERSATION) @Name("accountEditor") public class AccountEditorBean implements AccountEditor { @In(required=false) private AccountManager accountManager; @Valid private Account account; @In(create=true) private Session session; @Begin(join=true) public String select() { account = accountManager.getSelectedAccountSummary().getAccount(); return "editAccount"; } @End @IfInvalid(outcome=Outcome.REDISPLAY, refreshEntities=true) public String update() { session.update(account); return "home"; } public Account getAccount() { return account; } @Remove @Destroy public void destroy() {} }
I'm still trying to wrap my head around Seam, so I'm not quite sure why this bean works, but the other (stateless) bean doesn't. If you could offer any other suggestions or explanations, I would appreciate it. Otherwise, at least I seem to have found a working pattern.