I've assembled a
JSF application with JPA in Eclipse deploying this as a WAR file into
JBoss 5. I'm not using
EJB.
I created a Managed Bean that calls a DaoFactory that works with JPA to do my database transactions.
When this DaoFactory is created, an EntityManager is created holding it as an instance variable of my DaoFactory, such demonstrated below:
When a Dao is created, the EntityManager instance is passed through a constructor as follows:
The problem is: The EntityManagerFactory can't be created such as JBoss output said:
Unable to build EntityManagerFactory
org.hibernate.HibernateException: The chosen transaction strategy
requires access to the JTA TransactionManager
My persistence.xml was:
So, to solve that problem I changed the transaction-type to RESOURCE-LOCAL, and instead of using jta-data-source I started using non-jta-datasource
which is demonstrated below:
Now, the application works well creating the EntityManagerFactory and so I can persist my data.
I'd like to know why it happens with JBoss.
Does JTA cannot be used when I deploy like a WAR app? Does JTA only works with EJB?
Thanks in advance.