原帖地址:http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.3.0.cp04_fp01/html/Seam_Reference_Guide/ch10s02s02.html
Configuring a Seam transaction manager
Seam provides a transaction management abstraction for beginning,
committing, rolling back, and synchronizing with a transaction. By
default Seam uses a JTA transaction component that integrates with
Container Managed and programmatic EJB transactions. If you are working
in a Java EE 5 environment, you should install the EJB synchronization
component in components.xml:
<transaction:ejb-transaction />
However, if you are working in a non EE 5
container, Seam will try auto detect the transaction synchronization
mechanism to use. However, if Seam is unable to detect the correct
transaction synchronization to use, you may find you need configure one
of the following:
-
JPA RESOURCE_LOCAL transactions with the javax.persistence.EntityTransaction interface. EntityTransaction begins the transaction at the beginning of the apply request values phase.
-
Hibernate managed transactions with the org.hibernate.Transaction interface. HibernateTransaction begins the transaction at the beginning of the apply request values phase.
-
Spring managed transactions with the org.springframework.transaction.PlatformTransactionManager interface. The Spring PlatformTransactionManagement manager may begin the transaction at the beginning of the apply request values phase if the userConversationContext attribute is set.
-
Explicitly disable Seam managed transactions
Configure JPA RESOURCE_LOCAL transaction management by adding the following to your components.xml where
#{em} is the name of the
persistence:managed-persistence-context component. If your managed persistence context is named
entityManager, you can opt to leave out the
entity-manager attribute. (see
Section 10.3, “Seam-managed persistence contexts”Seam-managed persistence contexts)
<transaction:entity-transaction entity-manager="#{em}"/>
To configure Hibernate managed transactions declare the following in your components.xml where
#{hibernateSession} is the name of the project's
persistence:managed-hibernate-session component. If your managed hibernate session is named
session, you can opt to leave out the
session attribute. (see
Section 10.3, “Seam-managed persistence contexts”Seam-managed persistence contexts)
<transaction:hibernate-transaction session="#{hibernateSession}"/>
To explicitly disable Seam managed transactions declare the following in your components.xml:
<transaction:no-transaction />