Hi - I am new to Spring XA transactions. My app requires access to 2 different databases so I changed my transactionManager to use JTA via JOTM.
My security DAO's use one sessionFactory, and my application DAO's use another. Authentication and authorization work fine, but at the point of accessing application data from DAO #2, I receive an error "Entity not mapped".Code:<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction"> <bean class="org.springframework.transaction.jta.JotmFactoryBean"/> </property> </bean>
I did confirm that on app startup, the application Entities surely are getting mapped within their own session factory. So what appears to be happening is that the security session is opened and re-used for the application DAO. Sounds like a simple problem, but I have become a bit befuddled with its fix.
My application DAO's extend HibernateDaoSupport and hence use HibernateTemplate, which has a property called "alwaysUseNewSession". This sounds tempting but expensive. Thoughts/experiences? Thanks.


Reply With Quote