users@glassfish.java.net

Re: Problem with Persistence Engine : NamedQuery Not Found

From: Sébastien Stormacq <Sebastien.Stormacq_at_Sun.COM>
Date: Tue, 04 Nov 2008 08:55:33 +0100

Marian,

marsu:EFA_POC sst$ jar tfv ejbMessageTools/dist/ejbMessageTools.jar
      0 Mon Nov 03 23:46:34 CET 2008 META-INF/
     98 Mon Nov 03 23:46:32 CET 2008 META-INF/MANIFEST.MF
      0 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
      0 Mon Nov 03 23:46:32 CET 2008 com/
      0 Mon Nov 03 23:46:32 CET 2008 com/sun/
      0 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/
      0 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/
    524 Mon Nov 03 23:46:32 CET 2008 META-INF/persistence.xml
   2677 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
EFAConvertNumGPIIToVariableNumNTAService.wsdl
    747 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
EFAConvertNumGPIIToVariableNumNTAService_schema1.xsd
   2726 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
MessageValidationService.wsdl
    876 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
MessageValidationService_schema1.xsd
   2093 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/PrintingService.wsdl
    491 Mon Nov 03 23:46:32 CET 2008 META-INF/wsdl/
PrintingService_schema1.xsd
   2215 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/
EFAConvertNumGPIIToVariableNumNTA.class
   3877 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/
EfaSubstituteCharacters.class
   9015 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/MessageIN.xsd
   1137 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/MessageIN_EFA.xml
    716 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/
MessageOUTNormalization.class
   7958 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/
MessageValidation.class
   2340 Mon Nov 03 23:46:32 CET 2008 com/sun/poc/efa/Printing.class
120439 Mon Nov 03 23:46:32 CET 2008 custom.jar
163397 Mon Nov 03 23:46:32 CET 2008 customencoder-xsdextension.jar
180342 Mon Nov 03 23:46:32 CET 2008 ejbMessageTools.dbschema
675082 Mon Nov 03 23:46:32 CET 2008 encoderframework.jar
  47156 Mon Nov 03 23:46:32 CET 2008 encoderfrmwk-xsdextension.jar
2637744 Mon Nov 03 23:46:32 CET 2008 xbean.jar


BTW I am not using resource injection anymore, I am creating the
EntityManager and I am not using named queries ... it is working as
expected

         EntityManagerFactory emf =
Persistence.createEntityManagerFactory("ejbMessageToolsPU");
         EntityManager em = emf.createEntityManager();
         em.clear();

         //Query q =
em.createNamedQuery("EfaSubstituteCharacters.findAll");
         Query q = em.createQuery("SELECT e FROM
EfaSubstituteCharacters e");


Seb
---
Sébastien Stormacq
Senior Software Architect
GSS Software Practice,
Sun Microsystems Luxembourg
On 04 Nov 2008, at 00:13, Marina Vatkina wrote:
> 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>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>