Sorry my quotes got alittle messed up. :)
anonymous wrote : Hi,
|
| thank you for your helpful answer. I plan to have a seam independent
persistence and service layer using spring + JPA and only use seam in the web
layer because of its powerful JSF enhancements.
|
| Do I understand it right:
| 1. It is possible to use spring manged the local transaction instead of
JTA, but I need the RC1 or the SNAPSHOT of Seam. It is not possible with the
Beta1. It is important for me, because the application must run both on JBoss
and Tomcat. I want to know whether it is necessary to install the
embedded-jboss in Tomcat, so that I can use JTA.
|
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.
anonymous wrote :
| 2. Can I use JpaTransactionManager together with RESOURCE_LOCAL tx in
persistence.xml. I managed to have a working version with embedded-jboss and
JTA. I would like to see it also working with local tx.
|
Yes you can use JpaTransactionManager and do transaction management in spring
and not have to use the embedded-jboss and jta.
anonymous wrote :
| 3. Do I have to use seamEntityManagerFactory,or can I also use Spring
LocalContainerEntityManagerFactoryBean? What is the main job of
seamEntityManagerFactory?
|
If you configure it the way I described above you will be using the Spring
LocalContainerEntityManagerFactoryBean. It will be configured such that spring
provides the EntityManagerFactory. Seam provides it's conversation scoped
EntityManager and then SeamManagedEntityManagerFactoryBean takes the Seam
conversation scoped EntityManager and exposes it as another
EntityManagerFactoryBean that can then be used by JpaTransactionManager to
start and stop transactions and used by PersistenceAnnotationBeanPostProcessor
to inject the Seam conversation scoped EntityManager into your spring beans.
Which reminds me you will also need to update your
PersistenceAnnotationBeanPostProcessor to:
<bean
id="org.springframework.context.annotation.internalPersistenceAnnotationProcessor"
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
| <property name="defaultPersistenceUnitName"
value="seamEntityManagerFactory"/>
| </bean>
|
So that Spring will know that @PersistenceContext should inject the seam
entitymanager instance instead of creating a new spring managed one.
anonymous wrote :
| 4. The same question applies to persistence context. Does it need to be
managed by seam or can it also be managed by Spring?
|
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?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074533#4074533
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074533
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user