My currect project includes, JPA2.0 on Hibernate platform, HSQLDB2.0 and JBoss5.1 .
I have also defined datasource in JBoss under the name hmc.
Persistence.xml looks like :
<persistence-unit name=HMC><jta-data-source>java:/hmc</jta-data-source>...</persistence-unit>
Can anybody let me know
what is the difference between jta and non-jta datasource definition in JPA persistence.xml.
How to get connection, start a transaction in JTA mode?
I am bit confused as how to start a transaction for persisting the entities.
EntityManager works whenever select query is run, but doesnt work for persisting the data.
I tried
with EntityManager, it threw
IllegalStateException : A JTA EntityManager cannot use getTransaction()exception.with lookup of the datasource and was able to get connection object, but could not start transaction from that javax.sql.Connection object.
with @Inject, @Resource for EJBContext, EntityManager and UserTransaction.
Regards,
Satya