2 Replies Latest reply on Oct 5, 2005 10:36 AM by Patrik Björling Rygert

    JBoss 4.0.3 exception: Table not found: HIBERNATE_SEQUENCE i

    Patrik Björling Rygert Newbie

      I just upgraded from 4.0.3RC2 to 4.0.3 with EJB3 and got an exception on code that worked before. The stack trace I get looks like this:

      Does anybody know what the problem is?

      javax.ejb.EJBException: null; CausedByException is:
       could not get next sequence value
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:189)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:566)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:436)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:247)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:299)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)
      org.hibernate.exception.SQLGrammarException: could not get next sequence value
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:168)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:616)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:602)
       at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:156)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
       at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:384)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:160)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:608)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:594)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:140)
       at org.jboss.ejb3.entity.InjectedEntityManager.merge(InjectedEntityManager.java:102)
       at com.portwise.genua.authorization.accessrule.TestAccessRuleManagerBean.persist(TestAccessRuleManagerBean.java:65)
       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:109)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:189)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:566)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:436)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:247)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:299)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)
      Caused by: java.sql.SQLException: Table not found: HIBERNATE_SEQUENCE in statement [select next value for hibernate_sequence from information_schema.hibernate_sequence]
       at org.hsqldb.jdbc.Util.throwError(Unknown Source)
       at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
       at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
       at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:312)
       at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:172)
       at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:431)
       at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:99)
       at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
       ... 47 more
      org.hibernate.exception.SQLGrammarException: could not get next sequence value
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
       at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:168)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:616)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:602)
       at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:156)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:248)
       at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:384)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:160)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:608)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:594)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:140)
       at org.jboss.ejb3.entity.InjectedEntityManager.merge(InjectedEntityManager.java:102)
       at com.portwise.genua.authorization.accessrule.TestAccessRuleManagerBean.persist(TestAccessRuleManagerBean.java:65)
       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:109)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:189)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:566)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:436)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:247)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:299)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)
      Caused by: java.sql.SQLException: Table not found: HIBERNATE_SEQUENCE in statement [select next value for hibernate_sequence from information_schema.hibernate_sequence]
       at org.hsqldb.jdbc.Util.throwError(Unknown Source)
       at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
       at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
       at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.prepareStatement(BaseWrapperManagedConnection.java:312)
       at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:172)
       at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:431)
       at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:99)
       at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
       ... 47 more
      


        • 1. Re: JBoss 4.0.3 exception: Table not found: HIBERNATE_SEQUEN
          Patrik Björling Rygert Newbie

          The problem seems to be that I have used GeneratorType.SEQUENCE on a primary key. The reason for that is that AUTO doesn't work when I have an abstract base class with subclasses with one table per class:

          @Entity
          @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
          public abstract class AbstractAccessRule implements Serializable
          {
           private Long mID;
          
           @Id(generate = GeneratorType.SEQUENCE)
           @Column(name = "ID")
           public Long getID()
           {
           return mID;
           }
          
           ...
          


          If I use AUTO I get an "org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass>"

          • 2. Re: JBoss 4.0.3 exception: Table not found: HIBERNATE_SEQUEN
            Patrik Björling Rygert Newbie

            I just noticed that during my deploy I get the following messages:

            16:27:51,656 ERROR [SchemaExport] Unsuccessful: create table information_schema.hibernate_sequence (zero integer)
            16:27:51,656 ERROR [SchemaExport] invalid schema name in statement [create table information_schema.hibernate_sequence]
            16:27:51,656 ERROR [SchemaExport] Unsuccessful: insert into information_schema.hibernate_sequence values (0)
            16:27:51,656 ERROR [SchemaExport] Table not found: HIBERNATE_SEQUENCE in statement [insert into information_schema.hibernate_sequence]
            


            Is there a bug in Hibernate?