-
1. Re: Form submit trigger many updates
norman.richards Jan 3, 2007 7:36 PM (in response to milesif)Unfortunately, certain members of the spec committee kept this from being a standard flush mode for a JPA persistence context. Hibernate supports this, and seems gives access to it through @Begin(flushMode=MANUAL) and by setFlushModeManual() on the persistence provider component.
-
2. Re: Form submit trigger many updates
hstang Jan 3, 2007 7:48 PM (in response to milesif)Using a TransactionalSeamPhaseListener:
A non JSF request (a redirect for example)--transaction begins just before restore_view(rv) phase, and the same transaction commits just after rv. A second transaction begins before render response phase (rr), and commits after it.
For a JSF request(e.g. submit)--tx begins just before rv phase, and commits just after invoke application phase (after completion of your action method). Similarly to non jsf request, a second transaction begins before rr phase, and commits after.
That's why there isn't need to do explicit flush. If you really want to do that though, you can look into using atomic conversations. Set the flushModeType to manual, then Seam will only flush when you tell it to. The docs should have more about it. Good luck. -
3. Re: Form submit trigger many updates
milesif Jan 3, 2007 8:23 PM (in response to milesif)Thanks Richard and hstang,
ok, I will try setting flushModeType to manual.
Anyway, there are a few things that are not yet clear and I am curious about:
1. why with the SeamPhaseListener I get many updates as the number of values I changed in the form: maybe it is just a repeated log message while there is only one sql update command sent to the database?
2. it is possible that with the SeamPhaseListener some changes are applied before and some after my action method is called? Does this make sense?
3. how SeamPhaseListener manages transaction? Or it does not?
thanks again to everybody
Ciao Francesco -
4. Re: Form submit trigger many updates
norman.richards Jan 3, 2007 9:46 PM (in response to milesif)1 - I'm not sure. My guess is that each of those operations is happening in a new transaction. It wouldn't happen with the transactional phase listener because there would be one transaction covering all of the operations.
2. The changes are applied to the entity in the update model values phase, which is before the invoke application phase.
3. It doesn't. Use the TransactionalSeamPhaseListener for Seam to manage the transaction.