Julio Faerman schrieb:
> Well, i am using Jersey + JPA + Spring, so the EntityManager gets
> injected using the @PersistenceContext annotation.
> Works fine for me.
@PersistenceContext doesn't make the slightest difference for me,
no error messages, no functionality, nothing. Well, that is not exactly true,
if I do something that is obviously useless like
@PersistenceContext(unitName="test")
private void doNothing() {};
I get:
SEVERE|glassfish|global|_ThreadID=16;_ThreadName=Thread-3;|Injection method name must start with "set"
And it I use a wrong unitName in the annotation, I get a "Deployment Error --
Could not resolve a persistence unit ...".
So something *is* recognizing the annotation, it is only when I use textbook
code like
@PersistenceContext(unitName="test")
private EntityManager em;
that nothing happens at all so that em is always null.
The persistence unit is there, too, because I can get an EntityManager
with
private EntityManagerFactory emf = Persistence.createEntityManagerFactory("test");
private EntityManager em = emf.createEntityManager();
and then see the data in the database.
Does anyone know how to get the combination jersey / eclipselink /
{glassfish-v3-prelude|sailfin-v1-b60d} to work? What is the obvious stupid
missing piece? Another jar? A cryptic xml file? A ritually sacrificed sparc?
Spring???
- Florian