org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]: org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]

Hibernate JIRA | Johannes Zinn | 6 months ago
  1. 0

    We use identity generation with GenerationTyp.AUTO to support different DBMS (mssql and postgre) with a sequence generator for each Entity: {code:java} @SequenceGenerator(name = "SEQ_MY_CLASS", sequenceName = "SEQ_MY_CLASS") public class MyClass { private Integer id; .... @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_MY_CLASS") public Integer getId(){ ... } } {code} persistence.xml {code:xml} ... <property name="hibernate.hbm2ddl.auto" value="create" /> <property name="hibernate.default_schema" value="myschema" /> <property name="hibernate.default_catalog" value="mydatabase" /> <property name="hibernate.id.new_generator_mappings" value="true"/> ... {code} Hibernate generates the following SQL for creating the sequence, but MSSQL doesn't support providing catalog name on sequence creation. {code:sql} create sequence mycatalog.myschema.SEQ_MY_CLASS start with 1 increment by 50 {code} As result we receive the following Exception on wildfly startup: {code:java} 2016-06-09 13:13:30 INFO [ServerService Thread Pool -- 54] [] stdout: Hibernate: create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50 2016-06-09 13:13:30 WARN [ServerService Thread Pool -- 54] [] org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]: org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50] at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:63) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:567) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:551) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:289) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:137) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:110) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:176) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:64) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:458) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:465) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881) at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667) [wildfly-elytron-1.0.2.Final.jar:1.0.2.Final] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_45] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45] at org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 'CREATE SEQUENCE' does not allow specifying the database name as a prefix to the object name. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635) at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:865) at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:762) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159) at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:735) at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51) ... 19 more {code}

    Hibernate JIRA | 6 months ago | Johannes Zinn
    org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]: org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]
  2. 0

    We use identity generation with GenerationTyp.AUTO to support different DBMS (mssql and postgre) with a sequence generator for each Entity: {code:java} @SequenceGenerator(name = "SEQ_MY_CLASS", sequenceName = "SEQ_MY_CLASS") public class MyClass { private Integer id; .... @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_MY_CLASS") public Integer getId(){ ... } } {code} persistence.xml {code:xml} ... <property name="hibernate.hbm2ddl.auto" value="create" /> <property name="hibernate.default_schema" value="myschema" /> <property name="hibernate.default_catalog" value="mydatabase" /> <property name="hibernate.id.new_generator_mappings" value="true"/> ... {code} Hibernate generates the following SQL for creating the sequence, but MSSQL doesn't support providing catalog name on sequence creation. {code:sql} create sequence mycatalog.myschema.SEQ_MY_CLASS start with 1 increment by 50 {code} As result we receive the following Exception on wildfly startup: {code:java} 2016-06-09 13:13:30 INFO [ServerService Thread Pool -- 54] [] stdout: Hibernate: create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50 2016-06-09 13:13:30 WARN [ServerService Thread Pool -- 54] [] org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]: org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50] at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:63) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:567) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:551) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:289) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:137) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:110) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:176) at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:64) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:458) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:465) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881) at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667) [wildfly-elytron-1.0.2.Final.jar:1.0.2.Final] at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_45] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_45] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45] at org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 'CREATE SEQUENCE' does not allow specifying the database name as a prefix to the object name. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635) at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:865) at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:762) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159) at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:735) at org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51) ... 19 more {code}

    Hibernate JIRA | 6 months ago | Johannes Zinn
    org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl: GenerationTarget encountered exception accepting command : Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]: org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [create sequence mydatabase.myschema.SEQ_MY_CLASS start with 1 increment by 50]
  3. 0

    Arquillian Persistence Extension doesn't create schema with the annotation

    Stack Overflow | 3 years ago | Rajper
    org.jboss.arquillian.persistence.dbunit.exception.DBUnitDataSetHandlingException: Unable to execute line: CREATE TABLE SPK_CFG_Attrib
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error during upgrade, dot_containers

    Google Groups | 3 months ago | David Petersheim
    com.microsoft.sqlserver.jdbc.SQLServerException: The object 'dot_containers' does not exist or is invalid for this operation.
  6. 0

    Transaction Isolation Snapshot Exception on 2.1.1 upgrade

    GitHub | 4 years ago | NickPadilla
    com.microsoft.sqlserver.jdbc.SQLServerException: Transaction failed because this DDL statement is not allowed inside a snapshot isolation transaction. Since metadata is not versioned, a metadata change can lead to inconsistency if mixed within snapshot isolation.

    9 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.microsoft.sqlserver.jdbc.SQLServerException

      'CREATE SEQUENCE' does not allow specifying the database name as a prefix to the object name.

      at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError()
    2. com.microsoft.sqlserver
      SQLServerStatement.execute
      1. com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)
      2. com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1635)
      3. com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:865)
      4. com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:762)
      5. com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
      6. com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
      7. com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184)
      8. com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159)
      9. com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:735)
      9 frames
    3. IronJacamar
      WrappedStatement.execute
      1. org.jboss.jca.adapters.jdbc.WrappedStatement.execute(WrappedStatement.java:198)
      1 frame
    4. org.hibernate.tool
      SchemaManagementToolCoordinator.process
      1. org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51)
      2. org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:567)
      3. org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:551)
      4. org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:289)
      5. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:137)
      6. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:110)
      7. org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:176)
      8. org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:64)
      8 frames
    5. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:458)
      1 frame
    6. org.hibernate.boot
      SessionFactoryBuilderImpl.build
      1. org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:465)
      1 frame
    7. org.hibernate.jpa
      EntityManagerFactoryBuilderImpl.build
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881)
      1 frame
    8. org.jboss.as
      TwoPhaseBootstrapImpl.build
      1. org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
      1 frame
    9. JPA
      PersistenceUnitServiceImpl$1$1.run
      1. org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
      2. org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
      2 frames
    10. WildFly Security Manager
      WildFlySecurityManager.doChecked
      1. org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)[wildfly-elytron-1.0.2.Final.jar:1.0.2.Final]
      1 frame
    11. JPA
      PersistenceUnitServiceImpl$1.run
      1. org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
      1 frame
    12. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[rt.jar:1.8.0_45]
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[rt.jar:1.8.0_45]
      3. java.lang.Thread.run(Thread.java:745)[rt.jar:1.8.0_45]
      3 frames
    13. JBoss Threads
      JBossThread.run
      1. org.jboss.threads.JBossThread.run(JBossThread.java:320)
      1 frame