Configuring Local and JTA Transaction in Spring based Appplication using JPA
Issue
- Spring based applications using JPA having web service which uses 2 datasources which don't require
JTAsince there is no distributed transaction across the 2 databases.
The transactions are local to each of the databases. By using JPA for persistence andpersistence.xmlhasnon-jta datasourceconfigured andtransaction_typeis set to local.
When configured this way, persistence doesn't happen. Only after switching to a JTA transaction manager and usingJTA datasourceinpersistence.xml, the persistence does happen. Persistence.xml files contain one for each of the 2 datasources. Explain why and how supposed to be configured?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.3.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.