users@glassfish.java.net

Re: Problem with Persistence Engine : NamedQuery Not Found

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 03 Nov 2008 15:13:52 -0800

Hello,

What's the output of 'jar -tf'?

thanks,
-marina

Sébastien Stormacq wrote:
> Hello,
>
> I am deploying the webservice/SLSB, the PU and the Entity Beans in the
> same *jar* file
>
> Seb
> ---
> Sébastien Stormacq
> Senior Software Architect
> GSS Software Practice,
> Sun Microsystems Luxembourg
>
> On 03 Nov 2008, at 23:22, Marina Vatkina wrote:
>
>> Hello,
>>
>> Do you deploy the PU together with the SLSB? Do you deploy it as a jar
>> or an ear?
>>
>> thanks,
>> -marina
>>
>> Sébastien Stormacq wrote:
>>
>>> Hello,
>>
>>> Thanks for your answer.
>>
>>> I am injecting in a SLSB
>>
>>> My App is a BPEL /JBI app -> Web Service (SLSB) -> Entity Beans
>>
>>> Seb
>>
>>> ---
>>
>>> Sébastien Stormacq
>>
>>> Senior Software Architect
>>
>>> GSS Software Practice,
>>
>>> Sun Microsystems Luxembourg
>>
>>> On 03 Nov 2008, at 23:14, Marina Vatkina wrote:
>>
>>>> Are you injecting EM into a SLSB or in a helper class? What is the
>>>> structure of your app?
>>
>>>>
>>>> thanks,
>>
>>>> -marina
>>
>>>>
>>>> Sébastien Stormacq wrote:
>>
>>>>
>>>>> Hello,
>>
>>>>> Using GF 2.1 (9.1_02 b04)
>>
>>>>> I created an Entity Bean and Persistence Unit in an EJB project
>>
>>>>> When I am calling
>>
>>>>> em.createNamedQuery("MyEntity.findAll")
>>
>>>>> from a Stateless EJB (exposed as a Web Service) with a valid query
>>>>> name, I receive :
>>
>>>>> java.lang.IllegalArgumentException: NamedQuery of name:
>>>>> MyEntity.findAll not found.
>>
>>>>> at oracle .toplink .essentials .internal
>>>>> .ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:422)
>>
>>>>> at oracle .toplink .essentials .internal
>>>>> .ejb.cmp3.base.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:136)
>>
>>>>> at oracle .toplink .essentials .internal
>>>>> .ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java: 464)
>>
>>>>> at
>>>>> com.sun.poc.efa.MessageValidation.<init>(MessageValidation.java:61)
>>
>>>>> Using the exact same code in a POJO, outside of the application
>>>>> server container works as expected.
>>
>>>>> The GlassFish version uses JTA while the POJO version uses
>>>>> RESOURCE_LOCAL
>>
>>>>> Another issue, probably linked to this one : resource injection is
>>>>> not working for me :
>>
>>>>> @PersistenceContext
>>
>>>>> private EntityManager em;
>>
>>>>> em is null when I first use it.
>>
>>>>> I worked around by using :
>>
>>>>> EntityManagerFactory emf =
>>>>> Persistence.createEntityManagerFactory("myPU");
>>
>>>>> EntityManager em = emf.createEntityManager();
>>
>>>>> em.clear();
>>
>>>>> Any idea ? Thanks
>>
>>>>> ---
>>
>>>>> Sébastien Stormacq
>>
>>>>> Senior Software Architect
>>
>>>>> GSS Software Practice,
>>
>>>>> Sun Microsystems Luxembourg
>>
>>>>> ---------------------------------------------------------------------
>>
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>>
>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>> <mailto:users-help_at_glassfish.dev.java.net>
>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>>
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>> <mailto:users-help_at_glassfish.dev.java.net>
>>
>>>>
>>> ---------------------------------------------------------------------
>>
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>>
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>> <mailto:users-help_at_glassfish.dev.java.net>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>> <mailto:users-help_at_glassfish.dev.java.net>
>>
>