10 Replies Latest reply on Nov 21, 2011 2:13 AM by canhhiep

    ORA-02289: sequence does not exist when upgrade to JBoss 7

    canhhiep

      I have an issue related to sequence not found when I upgrade from JBoss 5 to JBoss 7, I think it related to hibernate (because hibernate version of JBoss 7 is 4).

       

      Below is the exception:

       

      at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:703) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
      at org
      .hibernate.internal.SessionImpl.persist(SessionImpl.java:707) [hibernate-core-4.0.0.CR6.jar:4.0.0.CR6]
      at org
      .hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:847) [hibernate-entitymana
      ger
      -4.0.0.CR6.jar:4.0.0.CR6]
      ... 159 more
      Caused by: java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist

      at oracle
      .jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
      at oracle
      .jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
      at oracle
      .jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
      at oracle
      .jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
      at oracle
      .jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
      at oracle
      .jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
      at oracle
      .jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
      at oracle
      .jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
      at oracle
      .jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
      at oracle
      .jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
      at oracle
      .jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
      at oracle
      .jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)

       

      Anyone know how to fix it? please let me know. I am using Oracle10gDialect and override getNativeIdentifierGeneratorClass() function by using my own SequenceGenerator. It has worked on Hibernate 3.5 but thrown exception when I upgraded to Hibernate 4.0.0.RC6

       

      This is my TableNameSequenceGenerator class:

       

      public class TableNameSequenceGenerator extends SequenceGenerator {

         
      public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
             
      if(params.getProperty(SEQUENCE) == null || params.getProperty(SEQUENCE).length() == 0) {
                 
      String tableName = params.getProperty(PersistentIdentifierGenerator.TABLE);
                 
      if(tableName != null) {
                     
      String seqName = tableName + "_SEQ";
                     
      params.setProperty(SEQUENCE, seqName);              
                 
      }
             
      }
             
      super.configure(type, params, dialect);
         
      }
      }

       

      When I do debugging by using hibernate 4, tableName return REVINFO only (it works in hibernate 3)

       

      Thanks

      Hiep