-
1. Re: Capturing a rollback or commit by Seam
gaborj Apr 8, 2010 7:46 PM (in response to rnicholson10)Hi,
Have you tried observing those nice build-in events? i.e. :
org.jboss.seam.afterTransactionSuccess.<entitySimpleName>
You can use also@Asynchronous
methods for the observer methods which will not block the caller thread...hope that helps...
-
2. Re: Capturing a rollback or commit by Seam
rnicholson10 Apr 8, 2010 11:43 PM (in response to rnicholson10)I'm looking for more of a global observer for the global transacttion demarcated by the action. Seeing when each entity commits really does not help me as I'm persisting over 10,000 entities in a single transaction and these entities consist of over 50 different types of entity.
So maybe I should rephrase my question. If I'm persisting many different types of entity in a single transaction how do I capture when this transaction commits of rolls back?
-
3. Re: Capturing a rollback or commit by Seam
kapitanpetko Apr 9, 2010 3:51 AM (in response to rnicholson10)Global transactions are implemented as a JSF listener (SeamPhaseListener). If all else fails, you can extend/override it and make it do what you want. That said, you can probably observe org.jboss.seam.afterTransactionCompletion to get notified when a transaction commits. It has a boolean parameter to tell you if it completed or failed.
HTH
-
4. Re: Capturing a rollback or commit by Seam
rnicholson10 Apr 10, 2010 4:12 PM (in response to rnicholson10)
Nikolay Elenkov wrote on Apr 09, 2010 03:51:
Global transactions are implemented as a JSF listener (SeamPhaseListener). If all else fails, you can extend/override it and make it do what you want. That said, you can probably observe org.jboss.seam.afterTransactionCompletion to get notified when a transaction commits. It has a boolean parameter to tell you if it completed or failed.
HTHBrilliant, the observer for afterTransactionCompletion was exactly what we needed. Strangly it seems to be undocumented! Is it guaranteed that this event will always fire, i.e. can we treat it like finally block of a try/catch?
-
5. Re: Capturing a rollback or commit by Seam
kapitanpetko Apr 11, 2010 8:31 AM (in response to rnicholson10)I certainly can't guarantee it :) Look at the code of SeamPhaseListener for details, but it should fire every time. It does seem it's not in the manual. I think it used to be in the 2.0.x version, but not a 100% sure. Or maybe it was in 'Seam in Action'.