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

dapeng do-not-reply at jboss.com
Thu Aug 16 08:22:18 EDT 2007


anonymous wrote : You only need RC1 or snapshot if you wish to use spring managed local transactions that are automatically created and committed by seam in a faces request. Of if you want to use Seam's @Transactional annotation. 

Is there a configuration example for using spring managed local tx? By talking  "automatically created and committed by seam in a faces request", do you mean the code started by the seam filter (listener)? Is it correct, that Seam will start 2 txs (using spring tx manager) for each jsf request and all methods marked with spring @Transactional will just take part in the tx silently?

anonymous wrote : Yes you can use JpaTransactionManager and do transaction management in spring and not have to use the embedded-jboss and jta.    

In tomcat6 the method getUserTransaction always exists with a NamingException(can not create resource) , if I haven't installed the embedded-jboss. Only NameNotFoundException is caught, no general NamingException. It results in a endless redirect loop. With Beta1 I only manage to get a running version with JTA and embedded-jboss.


anonymous wrote : <bean id="org.springframework.context.annotation.internalPersistenceAnnotationProcessor" class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
  |   | 		<property name="defaultPersistenceUnitName" value="seamEntityManagerFactory"/>
  |   | 	</bean>
  |   | 	

Are you sure the vlaue of defaultPersistenceUnitName should be seamEntityManagerFactory instead of something like customer-persistence-unit?

anonymous wrote : 
  | Configured the way I told you the PersistenceContext will be managed by Seam. If you want to take advantage of Seam's Conversation scoped PersistenceContexts then that is the way it will need to be. This in no way limits your ability to execute code asynchronously or outside of a Seam request though. Take a look at the spring-seam example. In there I was actually executing a spring configured timer task on a bean that used a Seam managed persistenceContext.
  | 
  | There is nothing that says you cannot use a Spring managed Entitymanager it just means you won't be able to take advantage of a Conversation scoped EntityManager.
  | 
  | Is there a particular reason why you would want to use a Spring managed EntityManager? 

That was exact my question. I was not sure, whether the seam entity manager is available, if the request is not a JSF one, which runs through the seam filter (listener), but e.g. a WS-call, which is directed directly to Spring. If I understand you right, the entity manager is still available.

Anyway, your advice has been very valuable. Thanks a lot.

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

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



More information about the jboss-user mailing list