geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KHAksnes <khaks...@gmail.com>
Subject Re: @PersistenceContext not working
Date Wed, 22 Dec 2010 23:06:24 GMT

>From chapter 5 in the EJB 3.0 persistence spec (top of page 118):
An entity manager whose underlying transactions are controlled through JTA
is termed a JTA entity
manager.
An entity manager whose underlying transactions are controlled by the
application through the EntityTransaction
API is termed a resource-local entity manager.
A container-managed entity manager must be a JTA entity manager. JTA entity
managers are only specified
for use in Java EE containers.
An application-managed entity manager may be either a JTA entity manager or
a resource-local entity
manager.

In other words a resource-local entity mangager is always
application-managed. You will probably want to use something like:

@PersistenceUnit("TestApp") 
EntityManagerFactory emf;

to get the EntityManagerFactory.
@PersistenceContext is for container-managed entity managers only. 


-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Re-PersistenceContext-not-working-tp2131727p2133973.html
Sent from the Users mailing list archive at Nabble.com.

Mime
View raw message