0

I am new to JPA and in many resources of JPA I encounter these two term(Container persistence unit and Non-container persistence unit) but I can not understand differences.Can anybody help me understand these phrases? what is the container ?is it something like Tomcat?

2 Answers 2

1

'Container' in this context means an EJB container, which is usually provided by a Java EE compliant application server.

Since Tomcat is not Java EE compliant, it is not a 'container' in the sense of the JPA spec. Tom EE however provides such a container as do other Java EE servers. Oracle provides a complete list of compliant servers.

The main difference is that in a container you can use JTA resources like transactions and a transaction-scoped EntityManager. Without a container you have to use ÈntityTransaction and an EXTENDED EntityManager.

0

In the attribute transaction-type can take one of the 2 values "RESOURCE_LOCAL" or "JTA".

JTA - Works on an application server environment. Transaction managed by the application server.

RESOURCE_LOCAL - You managed the transaction with your code. You can use this to work standalone during the development / testing phase.

Not the answer you're looking for? Browse other questions tagged or ask your own question.