users@jersey.java.net

Re: [Jersey] Jersey and JPA best practices?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 19 Dec 2008 10:08:14 +0100

Hi Florian,

I recommend emailing:

   mailto:users_at_glassfish.dev.java.net

to ask questions related to the persistence context support in EE.

Paul.

On Dec 18, 2008, at 6:33 PM, Florian Hars wrote:

> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>