you are sure of:
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName"
value="java:comp/env/comp/TransactionManager"/>
</bean>
<jee:jndi-lookup id="entitiesEntityManagerFactory"
jndi-name="persistence/entitiesPersistenceUnit"
resource-ref="true"/>
?
To get the transaction manager java:comp/Transactionmanager would be
the default name, you can call the static method
org.apache.openejb.OpenEJB.getTransactionManager() too (easily doable
in xml ;). About the emf the jndi name is not the unit name so if you
didn't bind it somewhere else it will not work. An easy workaround can
be to produce the EMF through CDI and get it from BeanProvider of
DeltaSpike or manually (3 lines of code)
*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*
2013/7/25 Chris Owens <[email protected]>
> I am trying to integrate some EJBs into a predominantly Spring application,
> hosted on tomEE+ and I'm just not understanding how to get the persistence
> context to propagate along with a transaction that starts in an EJB and
> invokes a method from a Spring bean.
>
> I have set up container managed datasources, transaction manager, and
> entitymanager (here's a relevant snippet from an applicationContext.xml).
>
>
> Anything that is entirely Spring or entirely EJB works just fine. But, if
> I
> get hold of a managed entity within an EJB and then invoke a method from a
> Spring bean, passing the entity as an argument, the Spring bean thinks its
> unmanaged. This is in spite of the EJB method being declared
> @TransactionAttribute and the Spring method being declared @Transactional
> with propagation Mandatory. Somehow the persistence context is not
> propagating with the transaction.
>
> Any ideas?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Shared-Persistence-Context-between-Spring-Beans-and-EJBs-tp4664343.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>