users@jersey.java.net

Re: [Jersey] Jersey and JPA best practices?

From: Julio Faerman <jfaerman_at_gmail.com>
Date: Thu, 18 Dec 2008 15:39:27 -0200

Spring, i guess. Or the ritual :)

On Thu, Dec 18, 2008 at 3:33 PM, Florian Hars <hars_at_bik-gmbh.de> 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
>
>