If you are switching over to the Java Persistence API, be aware of the numerous options and decisions you have to make to boost your application's performance. From Cache size, Pools to modes of operation, Rahul Biswas takes you through the steps.
You can use Java Persistence implementations that are compliant with JSR-220 in either of two modes: in-container and out-of-container. In-container mode means that the Java Persistence implementation is used inside of an EJB container. Entity managers, objects that manage persistence entities, are usually created by the EJB container. Entity managers are typically JTA entity managers. In other words, they participate in transactions controlled by the Java Transaction Architecture (JTA). However, the Java Persistence implementation must support both JTA entity managers and resource-local entity managers, that is, entity managers that participate in transactions not managed by JTA. In out-of-container mode the Java Persistence implementation is either standalone or runs inside of a web container. The application is responsible for creating it's own entity managers. Transactions are usually resource-local. If the implementation runs standalone, it does not need to support JTA.
Read the complete entry: http://blogs.sun.com/enterprisetechtips/entry/how_to_get_the_best