6 Replies Latest reply on May 28, 2008 10:04 AM by July Pyrra

    QuerySyntaxException Class is not mapped JBOSS 4.2.2GA EJB3

    July Pyrra Newbie

      Hola,

      I'm developing a web service with EJB3 and I kind of have some difficulties with all the persistence thing...

      I have a session bean Process which accesses a bean Query. This beans contains all the queries for the db hence the EntityManager.

      The deploy is ok, but when calling the web services which requires user identification and therefore a call to the db, the following error is thrown :

      2008-05-27 15:46:29,615 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] SOAP request exception
      javax.ejb.EJBTransactionRolledbackException: org.hibernate.hql.ast.QuerySyntaxException: Account is not mapped [select a from Account a ]
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
       at $Proxy596.AuthenticateUser(Unknown Source)
       at org.eu.nuadu.cuore.ws.process.Authentication.authenticate(Authentication.java:41)
       at org.eu.nuadu.cuore.ws.services.Update.SearchEvent(Update.java:22)
       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 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:103)
       at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:220)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:408)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
       at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Account is not mapped [select a from Account a ]
       at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:616)
       at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:95)
       at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:134)
       at org.eu.nuadu.cuore.bd.query.Query.AuthenticateUser(Query.java:89)
       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 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
       ... 70 more
      


      Here is my SessionBean
      package ws.process;
      
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      
      import bd.query.Query;
      import bd.query.QueryInt;
      import datamodel.DAO.SystemUser;
      
      public class Authentication {
      
       public void authenticate(){
       Context context = new InitialContext();
       QueryInt bean = (QueryInt) context.lookup("Query/remote");
      
       SystemUser _SystemUser = bean.AuthenticateUser();
       System.out.println(_SystemUser.getId());
       }
      }
      

      and my Bean
      package bd.query;
      
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      import datamodel.DAO.SystemUser;
      
      @Stateful
      public class Query implements QueryInt{
      
       public Query(){};
      
       @PersistenceContext(unitName="Nuadu")
       EntityManager em;
      
       public SystemUser AuthenticateUser(){
       SystemUser _SystemUser = (SystemUser) em.createQuery("select a from Account a ").getSingleResult();
       return _SystemUser;
       }
      }
      

      I'm deploying the DAO and DAO interface in a .jar, and the rest of the classes in another .jar.

      My persistence.xml is as simple as possible, Account is the name of the class (not the table's name in the DB), there is no case error...

      Any idea?

        • 1. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
          jaikiran pai Master

          Can you post the contents of your persistence.xml file and also the Account class? Also post the logs that you see on the console when your application is being deployed.

          • 2. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
            July Pyrra Newbie

            As I said, I'm working with EJB3 so it shouldn't have to deal with the persistence.xml or hibernate.cfg.xml

            persistence.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <persistence>
            
             <persistence-unit name="App">
             <provider>org.hibernate.ejb.HibernatePersistence</provider>
             <jta-data-source>java:/applids</jta-data-source>
             </persistence-unit>
            
            </persistence>
            


            Entity Account
            package datamodel.DAO;
            
            // Generated 13-may-2008 17:41:43 by Hibernate Tools 3.1.0.beta5
            
            import javax.persistence.Column;
            import javax.persistence.Entity;
            import javax.persistence.FetchType;
            import javax.persistence.GeneratedValue;
            import javax.persistence.Id;
            import javax.persistence.JoinColumn;
            import javax.persistence.ManyToOne;
            import javax.persistence.Table;
            
            /**
             * Account generated by hbm2java
             */
            @Entity
            @Table(name = "account", catalog = "appli", uniqueConstraints = {})
            public class Account implements java.io.Serializable {
            
             // Fields
            
             private int idAccount;
            
             private SystemUser systemUser;
            
             private String uid;
            
             private String pwd;
            
             private Boolean status;
            
             // Constructors
            
             /** default constructor */
             public Account() {
             }
            
             /** minimal constructor */
             public Account(int idAccount, SystemUser systemUser) {
             this.idAccount = idAccount;
             this.systemUser = systemUser;
             }
            
             /** full constructor */
             public Account(int idAccount, SystemUser systemUser, String uid,
             String pwd, Boolean status) {
             this.idAccount = idAccount;
             this.systemUser = systemUser;
             this.uid = uid;
             this.pwd = pwd;
             this.status = status;
             }
            
             // Property accessors
             @Id @GeneratedValue
             @Column(name = "idAccount", unique = true, nullable = false, insertable = true, updatable = true)
             public int getIdAccount() {
             return this.idAccount;
             }
            
             public void setIdAccount(int idAccount) {
             this.idAccount = idAccount;
             }
            
             @ManyToOne(cascade = {}, fetch = FetchType.LAZY)
             @JoinColumn(name = "idSystem_User", unique = false, nullable = false, insertable = true, updatable = true)
             public SystemUser getSystemUser() {
             return this.systemUser;
             }
            
             public void setSystemUser(SystemUser systemUser) {
             this.systemUser = systemUser;
             }
            
             @Column(name = "uid", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
             public String getUid() {
             return this.uid;
             }
            
             public void setUid(String uid) {
             this.uid = uid;
             }
            
             @Column(name = "pwd", unique = false, nullable = true, insertable = true, updatable = true, length = 65535)
             public String getPwd() {
             return this.pwd;
             }
            
             public void setPwd(String pwd) {
             this.pwd = pwd;
             }
            
             @Column(name = "status", unique = false, nullable = true, insertable = true, updatable = true)
             public Boolean getStatus() {
             return this.status;
             }
            
             public void setStatus(Boolean status) {
             this.status = status;
             }
            
            }
            




            • 3. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
              jaikiran pai Master

               

              "July Pyrra" wrote:
              As I said, I'm working with EJB3 so it shouldn't have to deal with the persistence.xml or hibernate.cfg.xml


              That's not entirely true. You dont have to deal with hibernate.cfg.xml but you do have to be aware of the persistence.xml (which is a JPA configuration file and part of EJB3).

              Is the Account.class and the persistence.xml, part of the same jar file?

              "jaikiran" wrote:

              Also post the logs that you see on the console when your application is being deployed.


              • 4. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
                July Pyrra Newbie

                The Account.class is part of the DAO and is in datamodel.jar while the other classes are in another services.jar file. I have packaged the persistence.xml in the META-INF of both jar.

                17:35:11,697 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.2.GA/server/appli/deploy/_julie/Datamodel.jar
                17:35:11,728 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
                17:35:11,728 INFO [JmxKernelAbstraction] installing MBean: persistence.units:jar=app.jar,unitName=app with dependencies:
                17:35:11,728 INFO [JmxKernelAbstraction] jboss.jca:name=applids,service=DataSourceBinding
                17:35:11,728 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:jar=app.jar,unitName=app
                17:35:11,744 INFO [Configuration] Reading mappings from resource : META-INF/orm.xml
                17:35:11,744 INFO [Ejb3Configuration] [PersistenceUnit: app] no META-INF/orm.xml found
                17:35:11,759 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
                17:35:11,759 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
                17:35:11,759 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.45-community-nt
                17:35:11,759 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.3 ( $Date: 2006-07-26 17:26:47 +0200 (Wed, 26 Jul 2006) $, $Revision: 5553
                 $ )
                17:35:11,759 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
                17:35:11,759 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
                17:35:11,759 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
                17:35:11,775 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
                17:35:11,775 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
                17:35:11,775 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
                17:35:11,775 INFO [SettingsFactory] JDBC batch size: 15
                17:35:11,790 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
                17:35:11,790 INFO [SettingsFactory] Scrollable result sets: enabled
                17:35:11,790 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
                17:35:11,806 INFO [SettingsFactory] Connection release mode: auto
                17:35:11,806 INFO [SettingsFactory] Maximum outer join fetch depth: 2
                17:35:11,806 INFO [SettingsFactory] Default batch fetch size: 1
                17:35:11,806 INFO [SettingsFactory] Generate SQL with comments: disabled
                17:35:11,822 INFO [SettingsFactory] Order SQL updates by primary key: disabled
                17:35:11,822 INFO [SettingsFactory] Order SQL inserts for batching: disabled
                17:35:11,822 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
                17:35:11,822 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
                17:35:11,822 INFO [SettingsFactory] Query language substitutions: {}
                17:35:11,822 INFO [SettingsFactory] JPA-QL strict compliance: enabled
                17:35:11,822 INFO [SettingsFactory] Second-level cache: enabled
                17:35:11,837 INFO [SettingsFactory] Query cache: disabled
                17:35:11,837 INFO [SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
                17:35:11,837 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
                17:35:11,837 INFO [SettingsFactory] Cache region prefix: app_jar,app
                17:35:11,853 INFO [SettingsFactory] Structured second-level cache entries: disabled
                17:35:11,853 INFO [SettingsFactory] Statistics: disabled
                17:35:11,853 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
                17:35:11,853 INFO [SettingsFactory] Default entity-mode: pojo
                17:35:11,869 INFO [SettingsFactory] Named query checking : enabled
                17:35:11,869 INFO [SessionFactoryImpl] building session factory
                17:35:11,869 INFO [SessionFactoryObjectFactory] Factory name: persistence.units:jar=app.jar,unitName=app
                17:35:11,884 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming
                :org.jnp.interfaces}
                17:35:11,884 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.units:jar=app.jar,unitName=app
                17:35:11,884 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
                17:35:11,900 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming
                :org.jnp.interfaces}
                17:35:11,900 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
                17:35:11,900 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=app.jar,name=Update,service=EJB3 with dependencies:
                17:35:11,931 INFO [EJBContainer] STARTED EJB: ws.services.Update ejbName: Update
                17:35:11,994 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateful.StatefulContainer
                17:35:12,009 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=app.jar,name=Query,service=EJB3 with dependencies:
                17:35:12,009 INFO [JmxKernelAbstraction] persistence.units:jar=app.jar,unitName=app
                17:35:12,040 INFO [EJBContainer] STARTED EJB: bd.query.Query ejbName: Query
                17:35:12,087 INFO [EJB3Deployer] Deployed: file:/D:/jboss-4.2.2.GA/server/appli/deploy/_julie/app.jar
                17:35:14,119 INFO [WSDLFilePublisher] WSDL published to: file:/D:/jboss-4.2.2.GA/server/appli/data/wsdl/app.jar/UpdateService57618.wsdl
                17:35:14,806 INFO [DefaultEndpointRegistry] register: jboss.ws:context=app,endpoint=Update
                17:35:14,837 INFO [TomcatDeployer] deploy, ctxPath=/app, warUrl=.../tmp/deploy/app.jar57620.war/
                17:35:14,994 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
                17:35:15,556 INFO [Http11Protocol] DÚmarrage de Coyote HTTP/1.1 sur http-giggles.lst.tfo.upm.es%2F138.4.10.233-8080
                17:35:15,587 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-giggles.lst.tfo.upm.es%2F138.4.10.233-8009
                17:35:15,603 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 58s:48ms
                
                


                There are 2000 lines displayed in the console since it's a big application and a lot of things are not useful, so this is the end of the console concerning the persistence... I hope it helps... sorry

                • 5. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
                  jaikiran pai Master

                  As i suspected, the logs show no indication that the "Account" entity is being mapped. For example, when i deploy my sample application with entities, i see this on the console:

                  8:18:47,998 INFO [JmxKernelAbstraction] jboss.jca:name=EJB3PersistenceDS,service=DataSourceBinding
                  8:18:47,998 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:ear=EJB3Persistence.ear,jar=myapp_ejb3.jar,unitName=EJB3Persistence
                  8:18:48,060 INFO [Version] Hibernate EntityManager 3.2.1.GA
                  8:18:48,107 INFO [Version] Hibernate Annotations 3.2.1.GA
                  8:18:48,123 INFO [Environment] Hibernate 3.2.4.sp1
                  8:18:48,138 INFO [Environment] hibernate.properties not found
                  8:18:48,138 INFO [Environment] Bytecode provider name : javassist
                  8:18:48,138 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
                  .....
                  
                  8:18:48,857 INFO [AnnotationBinder] Binding entity from annotated class: org.myapp.entity.User
                   8:18:48,935 INFO [EntityBinder] Bind entity org.myapp.entity.User on table User
                  8:18:49,467 INFO [AnnotationBinder] Binding entity from annotated class: org.myapp.entity.Account
                  8:18:49,467 INFO [EntityBinder] Bind entity org.myapp.entity.Account on table Account
                  8:18:49,482 INFO [AnnotationBinder] Binding entity from annotated class: org.myapp.entity.TestIdClass
                  8:18:49,513 INFO [EntityBinder] Bind entity org.myapp.entity.TestIdClass on table EJB3Test
                  8:18:49,529 INFO [AnnotationBinder] Binding entity from annotated class: org.myapp.entity.DeleteMe
                  8:18:49,529 INFO [EntityBinder] Bind entity org.myapp.entity.DeleteMe on table DELETEME
                  8:18:49,560 INFO [CollectionBinder] Mapping collection: org.myapp.entity.User.accounts -> Account
                  8:18:50,185 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
                  8:18:50,201 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
                  8:18:50,654 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.20-community


                  It looks like a packaging problem.

                  The Account.class is part of the DAO and is in datamodel.jar while the other classes are in another services.jar file. I have packaged the persistence.xml in the META-INF of both jar.


                  Usually, the persistence.xml file should be present in only the jar which contains the entity classes. Try removing the persistence.xml file from the services.jar file (which i assume does not have any entities).




                  • 6. Re: QuerySyntaxException Class is not mapped JBOSS 4.2.2GA E
                    July Pyrra Newbie

                    Got it! You pointed the right thing!

                    Thank you very much... A lot of the problems I've tried to solve these last days where caused by all that persistence thing.
                    Now I think I've got it all clear.

                    Therefore I packaged my DAO AND my class query in a datamodel.jar file with the persistence.xml in the META-INF. All my other classes are packaged in a services.jar file and it's aaaaaaaaall good!

                    This sort of thing may be very obvious to some people but it wasn't at all to me so thanks again! I offer you my eternal gratitude!