If I am working in an EJB environment, do I always have to install the synchronization component? If not, when do I have to do it? Why? Does the default configuration not work?
I also read the corresponding chapter in
Seam in Action, but I still fail to understand this.
What did I miss?
Thans for your help.
You do not need to implement a synchronization component (actually when you have seam managed transactions). As I understood, you have the possibility to give further instructions for transaction handling with a synchronization implementation, when
is installed, but commit and rollback actions to the database are still managed by Seam.
In the case of our application, we have ejb-transactions enabled and we use it to apply revision management. We get a javax.transaction.UserTransaction by doing a jndi lookup on
java:comp/UserTransaction, we store transaction data like updates in another bean which we map to the current transaction and we register a synchronization
((UserTransaction) Component.getInstance("org.jboss.seam.transaction.transaction", ScopeType.EVENT) ).registerSynchronization(sync)
which implements beforeCompletion and afterCompletion methods.