users@glassfish.java.net

Re: Creating a JNDI for MySQL ?

From: <glassfish_at_javadesktop.org>
Date: Thu, 18 Oct 2007 17:41:19 PDT

I have 3 classes ( source code, see earlier post from me ).
2 entity-classes: Project & Task ( tables with the same name in my database)
and 1 webservice class ( ProjectManagerWs.java ) that is injected with an entitymanager ...

after changing my persistence.xml according to ideas from
here: [i]http://www.nabble.com/persistence.xml-not-picked-up-in-webapp-t908592.html[/i]

looks like:
 <<?xml version="1.0" encoding="UTF-8"?>
<persistence>
   <persistence-unit name="company">
   <jta-data-source>jdbc/company</jta-data-source>
          <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
          <class>ws.ProjectManagerWs</class>
          <properties>
              <property name="jdbc.driver" value="org.gjt.mm.mysql.Driver"/>
              <property name="jdbc.connection.string" value="jdbc:mysql://localhost:3306/smallcompany"/>
              <property name="jdbc.user" value="root"/>
              <property name="jdbc.password" value="root"/>
              <property name="toplink.logging.level" value="INFO"/>
              <property name="no.weaving" value="true"/>
          </properties>
      </persistence-unit>
 </persistence>



[b]I get the following error when trying to fetch from the database:[/b]

25 more Caused by: [b]java.lang.IllegalArgumentException: NamedQuery of name: Project.findAllProjects not found.[/b] 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 ws.ProjectManagerWs.getProjects(ProjectManagerWs.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986) at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:189) ... 63 more

seems like my entity-class cannot be found ?
it is that entity-class that has a @NamedQuery
Should I bee using another Factory ?
rather than the oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider ?
or could I provide that Factory-klass ( from some jar ? )

regards, i
[Message sent by forum member 'inkimar' (inkimar)]

http://forums.java.net/jive/thread.jspa?messageID=241072