[jboss-user] [JBoss Seam] - Re: TransactionalSeamPhaseListener + Spring @Transactional

youngm do-not-reply at jboss.com
Wed Aug 15 11:07:38 EDT 2007


anonymous wrote : 1. I am not able to locate the class TransactionalSeamPhaseListener in Seam 2.0? Has it been replaced by the general SeamPhaseListener?
  | 

Ya, it was removed in 2.0 beta and was replaced by the "transaction-management-enabled" attribute
anonymous wrote : 
  | 2. Where can I download the 2.0.0. CR1? (you mean RC1?)
  | 
Unfortunately it is not out yet.  Feel free to checkout the latest from CVS and build your own snapshot though.
anonymous wrote : 
  | 3. I want to deploy my application in Tomcat, where no UserTransaction is available in JNDI? I encountered some problem in the class org.jboss.seam.transaction.Transaction, which always exists the method getUserTransaction with a runtime exception: I am forced to disable the seam tx management in components.xml with <core:init debug="true" transaction-management-enabled="false"/> to get rid of the problem. But I think I am then only relying on the spring tx management and might get LazyInitilizationException. Is my understanding right? 
So first of all in 2.0.0 CR1 you will be able to use a spring TM as a Seam TM and will be able to enable "transaction-management-enabled".  For now though who is doing the transaction management has nothing to do with getting LazyInitializationExceptions.  What "transaction-management-enabled" disabled will mean is that when you wish to flush() your conversation scoped PC it will be best to do it inside of a Service call with @Transactional.

Otherwise your configuration looks fine otherwise.  A couple of points:

1.  You don't need to inject a dataSource into your JpaTransactionManager.  I'm not sure if it will mess things up or not but I know it is not necessary.

2.  Make sure your components.xml has your entityManager definition:


  |     <persistence:managed-persistence-context name="entityManager"
  |                                       auto-create="true" 
  | entity-manager-factory="#{entityManagerFactory}"/>

And uncomment and rename your SeamManagedEntityManagerFactoryBean to something like:

  | 	<bean id="seamEntityManagerFactory"
  | 		class="org.jboss.seam.ioc.spring.SeamManagedEntityManagerFactoryBean">
  | 		<property name="persistenceContextName" value="entityManager" />
  | 		</bean>

And make sure that you use your seamEntityManagerFactory with your JpaTransactionManager like:

  | 	<bean id="transactionManager"
  | 		class="org.springframework.orm.jpa.JpaTransactionManager">
  | 		<property name="entityManagerFactory"
  | 			ref="seamEntityManagerFactory" />
  | 	</bean>
  | 

Otherwise read over more closely the Seam+Spring docs regarding Persistence contexts.

Mike

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074470#4074470

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074470



More information about the jboss-user mailing list