users@glassfish.java.net

Re: Persistence Glassfish RESOURCE_LOCAL

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 27 Jul 2009 10:32:28 -0700

glassfish_at_javadesktop.org wrote:
> Hello Marina,
>
> what do you mean by "lookup an EM for a RESOURCE_LOCAL pu " ?

em = ic.lookup(".../mypu");
>
> Anyway, i indeed have an @PersistenceContext private member in a class, a DAO
> actually. I have a Spring configuration - doesn't quite matter.
>
> What happens is, that at DEPLOYMENT time, Glassfish scans the classes and it
> throws this error when finding my @PersistenceContext who references this
> RESOURCE_LOCAL pu declared in my persistence.xml

You can't do that. You need to inject an emf via @PersistenceUnit and create em
from it.

>
> There's a way to stop the scanning at deployment, a <web-application > xml
> attribute, don't remember which, in web.xml.
>
> Anyway the point is, when can you deploy successfully deploy a web app with a
> RESOURCE_LOCAL pu in persistence.xml? Only when you have no
> @PersistenceContext and just @PersistenceUnit?

Right.

>
> Why is RESOURCE_LOCAL needed in fact? [Message sent by forum member
> 'vladbalan' (vladbalan)]
>
> http://forums.java.net/jive/thread.jspa?messageID=357730
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net For additional
> commands, e-mail: users-help_at_glassfish.dev.java.net
>