0 Replies Latest reply on Dec 18, 2008 2:19 AM by Vinh Tran

    javax.ejb.EJBException: javax.persistence.PersistenceExcepti

    Vinh Tran Newbie

      Hi everybody,

      I'm very new to JBoss AS and trying to do EJB persistence but I got this problem. I don't know how to solve it. Let me state my problem so you can help.

      I tried to develop a simple Stateless session bean as follows:
      @Stateless
      public class StockTypeFacade implements StockTypeFacadeRemote {

      @PersistenceContext
      private EntityManager entityManager;
      /**
      * Find all User entities.
      *
      * @return List all User entities
      */
      @SuppressWarnings("unchecked")
      public List findAll() {
      LogUtil.log("finding all StockType instances", Level.INFO, null);
      try {
      final String queryString = "select model from StockType model";
      Query query = entityManager.createQuery(queryString);
      return query.getResultList();
      } catch (RuntimeException re) {
      LogUtil.log("find all failed", Level.SEVERE, re);
      throw re;
      }
      }
      }


      Then deployed it to JBoss-4.2.2.GA with the following result:

      13:54:17,384 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
      13:54:17,384 INFO [JmxKernelAbstraction] installing MBean: persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU with dependencies:
      13:54:17,384 INFO [JmxKernelAbstraction] jboss.jca:name=DefaultDS,service=DataSourceBinding
      13:54:17,384 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:17,415 INFO [Ejb3Configuration] found EJB3 Entity bean: Address
      13:54:17,431 INFO [Ejb3Configuration] found EJB3 Entity bean: Stock
      13:54:17,431 INFO [Ejb3Configuration] found EJB3 Entity bean: StockPriceHistory
      13:54:17,446 INFO [Ejb3Configuration] found EJB3 Entity bean: StockType
      13:54:17,462 INFO [Ejb3Configuration] found EJB3 Entity bean: Transaction
      13:54:17,462 INFO [Ejb3Configuration] found EJB3 Entity bean: User
      13:54:17,571 INFO [Configuration] Reading mappings from resource : META-INF/orm.xml
      13:54:17,571 INFO [Ejb3Configuration] [PersistenceUnit: HelloEBJDatabasePU] no META-INF/orm.xml found
      13:54:17,571 INFO [AnnotationBinder] Binding entity from annotated class: Address
      13:54:17,571 INFO [EntityBinder] Bind entity Address on table address
      13:54:17,587 INFO [AnnotationBinder] Binding entity from annotated class: Stock
      13:54:17,587 INFO [EntityBinder] Bind entity Stock on table stock
      13:54:17,603 INFO [AnnotationBinder] Binding entity from annotated class: StockPriceHistory
      13:54:17,603 INFO [EntityBinder] Bind entity StockPriceHistory on table stock_price_history
      13:54:17,603 INFO [AnnotationBinder] Binding entity from annotated class: StockType
      13:54:17,603 INFO [EntityBinder] Bind entity StockType on table stock_type
      13:54:17,603 INFO [AnnotationBinder] Binding entity from annotated class: Transaction
      13:54:17,603 INFO [EntityBinder] Bind entity Transaction on table transaction
      13:54:17,618 INFO [AnnotationBinder] Binding entity from annotated class: User
      13:54:17,618 INFO [EntityBinder] Bind entity User on table user
      13:54:17,634 INFO [CollectionBinder] Mapping collection: Address.users -> user
      13:54:17,634 INFO [CollectionBinder] Mapping collection: Stock.transactions -> transaction
      13:54:17,634 INFO [CollectionBinder] Mapping collection: Stock.stockPriceHistories -> stock_price_history
      13:54:17,634 INFO [CollectionBinder] Mapping collection: StockType.stocks -> stock
      13:54:17,634 INFO [CollectionBinder] Mapping collection: User.transactions -> transaction
      13:54:17,696 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      13:54:17,696 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      13:54:17,696 INFO [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
      13:54:17,696 INFO [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
      13:54:17,696 INFO [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
      13:54:17,712 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
      13:54:17,712 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
      13:54:17,712 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
      13:54:17,712 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
      13:54:17,712 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
      13:54:17,712 INFO [SettingsFactory] JDBC batch size: 15
      13:54:17,712 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
      13:54:17,712 INFO [SettingsFactory] Scrollable result sets: enabled
      13:54:17,712 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
      13:54:17,712 INFO [SettingsFactory] Connection release mode: auto
      13:54:17,712 INFO [SettingsFactory] Default batch fetch size: 1
      13:54:17,712 INFO [SettingsFactory] Generate SQL with comments: disabled
      13:54:17,712 INFO [SettingsFactory] Order SQL updates by primary key: disabled
      13:54:17,712 INFO [SettingsFactory] Order SQL inserts for batching: disabled
      13:54:17,712 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
      13:54:17,712 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
      13:54:17,712 INFO [SettingsFactory] Query language substitutions: {}
      13:54:17,712 INFO [SettingsFactory] JPA-QL strict compliance: enabled
      13:54:17,712 INFO [SettingsFactory] Second-level cache: enabled
      13:54:17,728 INFO [SettingsFactory] Query cache: disabled
      13:54:17,728 INFO [SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
      13:54:17,728 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
      13:54:17,728 INFO [SettingsFactory] Cache region prefix: HelloEBJDatabase_jar,HelloEBJDatabasePU
      13:54:17,728 INFO [SettingsFactory] Structured second-level cache entries: disabled
      13:54:17,728 INFO [SettingsFactory] Statistics: disabled
      13:54:17,728 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
      13:54:17,728 INFO [SettingsFactory] Default entity-mode: pojo
      13:54:17,728 INFO [SettingsFactory] Named query checking : enabled
      13:54:17,743 INFO [SessionFactoryImpl] building session factory
      13:54:17,915 INFO [SessionFactoryObjectFactory] Factory name: persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:17,915 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      13:54:17,915 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:17,915 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
      13:54:17,915 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      13:54:17,946 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:17,946 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=AddressFacade,service=EJB3 with dependencies:
      13:54:17,946 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:17,978 INFO [EJBContainer] STARTED EJB: AddressFacade ejbName: AddressFacade
      13:54:18,040 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:18,040 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=StockFacade,service=EJB3 with dependencies:
      13:54:18,056 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:18,087 INFO [EJBContainer] STARTED EJB: StockFacade ejbName: StockFacade
      13:54:18,134 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:18,134 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=StockPriceHistoryFacade,service=EJB3 with dependencies:
      13:54:18,134 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:18,197 INFO [EJBContainer] STARTED EJB: StockPriceHistoryFacade ejbName: StockPriceHistoryFacade
      13:54:18,228 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:18,228 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=StockTypeFacade,service=EJB3 with dependencies:
      13:54:18,228 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:18,259 INFO [EJBContainer] STARTED EJB: StockTypeFacade ejbName: StockTypeFacade
      13:54:18,290 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:18,290 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=TransactionFacade,service=EJB3 with dependencies:
      13:54:18,290 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:18,322 INFO [EJBContainer] STARTED EJB: TransactionFacade ejbName: TransactionFacade
      13:54:18,353 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      13:54:18,353 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=HelloEBJDatabase.jar,name=UserFacade,service=EJB3 with dependencies:
      13:54:18,353 INFO [JmxKernelAbstraction] persistence.units:jar=HelloEBJDatabase.jar,unitName=HelloEBJDatabasePU
      13:54:18,431 INFO [EJBContainer] STARTED EJB: UserFacade ejbName: UserFacade
      13:54:18,493 INFO [EJB3Deployer] Deployed: file:/C:/jboss-4.2.2.GA/server/default/deploy/HelloEBJDatabase.jar/

      ===============================================
      Then I tried to run the following client application

      public static void main(String[] args) {
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      System.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interface");
      System.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");

      try {
      Context ctx = new InitialContext(System.getProperties());
      StockTypeFacadeRemote stF = (StockTypeFacadeRemote)ctx.lookup("StockTypeFacade/remote");
      List sTypes = stF.findAll();
      for (Iterator _iterator = sTypes.iterator(); _iterator.hasNext();) {
      StockType _stockType = (StockType) _iterator.next();
      System.out.println(_stockType.getStockTypeDescriptoin());
      }
      }
      }
      ======================================
      Then the following error shows up:

      Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
      javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
      at StockTypeFacade.findAll(StockTypeFacade.java:138)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
      at org.jboss.remoting.Client.invoke(Client.java:1634)
      at org.jboss.remoting.Client.invoke(Client.java:548)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy1.findAll(Unknown Source)
      at _ClientProgram.main(_ClientProgram.java:56)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy1.findAll(Unknown Source)
      at _ClientProgram.main(_ClientProgram.java:56)
      Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.doList(Loader.java:2223)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
      at org.hibernate.loader.Loader.list(Loader.java:2099)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
      at StockTypeFacade.findAll(StockTypeFacade.java:138)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.sql.SQLException: invalid schema name: STOCKTRACKER in statement [select stocktype0_.STOCK_TYPE_ID as STOCK1_15_, stocktype0_.STOCK_TYPE_DESCRIPTOIN as STOCK2_15_ from stocktracker.stock_type stocktype0_]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.(Unknown Source)
      at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.doPrepareStatement(BaseWrapperManagedConnection.java:349)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:337)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:187)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
      at org.hibernate.loader.Loader.doQuery(Loader.java:673)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.doList(Loader.java:2220)
      ... 42 more
      javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
      at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
      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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
      at StockTypeFacade.findAll(StockTypeFacade.java:138)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
      at org.jboss.remoting.Client.invoke(Client.java:1634)
      at org.jboss.remoting.Client.invoke(Client.java:548)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy1.findAll(Unknown Source)
      at _ClientProgram.main(_ClientProgram.java:56)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      at $Proxy1.findAll(Unknown Source)
      at _ClientProgram.main(_ClientProgram.java:56)
      Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.loader.Loader.doList(Loader.java:2223)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
      at org.hibernate.loader.Loader.list(Loader.java:2099)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
      at StockTypeFacade.findAll(StockTypeFacade.java:138)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
      at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
      at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.sql.SQLException: invalid schema name: STOCKTRACKER in statement [select stocktype0_.STOCK_TYPE_ID as STOCK1_15_, stocktype0_.STOCK_TYPE_DESCRIPTOIN as STOCK2_15_ from stocktracker.stock_type stocktype0_]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.(Unknown Source)
      at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.doPrepareStatement(BaseWrapperManagedConnection.java:349)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:337)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:187)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
      at org.hibernate.loader.Loader.doQuery(Loader.java:673)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
      at org.hibernate.loader.Loader.doList(Loader.java:2220)
      ... 42 more


      It seems that the error is about INVALID SCHEMA NAME but it cannot be since the schema on my MySQL is exactly the same.

      Can anyone please explain me what's wrong happening?

      Thanks,
      Vinh