Hello ,
We have a project which is using JPA (over hibernate). We are using Weblogic 11g application server.
Now till now we were using non -jta transaction throughout our application. All
jdbc action was being done in DAO classes , using persistencemanager.
There is a requirement to use JTA at some places where we need to execute JDBC, JMS and some cache updates in one global transactions. For this we need to use JTA now.
So few questions I have are
1) can we use JTA and Non - Jta transactions using same persistenceUnit?
2) Do I need to define a JTA data source in JTA transaction?
3) To use JTA transaction in this case is following good enough
- Define hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WeblogicTransactionManagerLookup
- Use JNDI to get UserTransactions and begin and commit it.
- create XA resources for hibernate and JMS between these.
How will Hibernate or JMS code will know that we need to associate the transaction with a global user transaction in this case?
Code I have is as follows
My persistence.xml looks like following
my jpa.properties looks like following
where MyDS is a non JTA data source defined in my weblogic server.
Also we have own classes to create PersistenceManager by parsing the persistence.xml and using persistenceUnitInfo classes.
Any pointers regarding this will be really helpful.
Thanks
Hildich K