org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [ create table Order ( order_id integer not null auto_increment, address varchar(255), name varchar(255), primary key (order_id) )]

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Schema Exception Hibernate One to Many

    Stack Overflow | 7 months ago | Hadrian Blackwater
    org.hibernate.tool.schema.spi.CommandAcceptanceException: Unable to execute command [ create table Order ( order_id integer not null auto_increment, address varchar(255), name varchar(255), primary key (order_id) )]
  2. 0

    Why Hibernate can not create table?

    Stack Overflow | 4 days ago | Catherine
    org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
  3. 0

    MySQL error: Specified key was too long; max key length is 767 bytes

    GitHub | 4 months ago | vrozkovec
    org.polyjdbc.core.exception.SchemaManagerException: [DDL_ERROR] Failed to run DDL: CREATE TABLE jv_commit_property ( property_name VARCHAR(200), property_value VARCHAR(200), commit_fk BIGINT, CONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name), CONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk) ) ENGINE = InnoDB
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    MySQL version - 5.7.15 Hibernate version - hibernate-core | 5.2.3.Final Implementation - JPA 2.1 +persistence.xml file+ {code:xml} <persistence-unit name="defaultPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <non-jta-data-source>DefaultDS</non-jta-data-source> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> <properties> <!--Hibernate properties--> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.id.new_generator_mappings" value="false"/> <property name="hibernate.connection.CharSet" value="UTF-8"/> <property name="hibernate.connection.characterEncoding" value="utf8"/> <property name="hibernate.connection.useUnicode" value="true"/> </properties> </persistence-unit> {code} {code:java} @Entity @Table(name = "CUSTOMER") public class Customer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "CUSTOMER_ACCOUNT_NUMBER") public Long customerAccountNumber; @Basic @Column(name = "CUSTOMER_ID", unique = true) public String customerId; @Basic @Column(name = "BILLING_ADDRESS") public String billingAddress; public Customer() {} } {code} During startup it generates following error in the logs {noformat} alter table CUSTOMER drop constraint UK_8eumjccoobf7t6psn9exu4gnh Hibernate: alter table CUSTOMER add constraint UK_8eumjccoobf7t6psn9exu4gnh unique (CUSTOMER_ID) [error] o.j.StatementLogger - java.sql.Statement.execute: alter table CUSTOMER drop constraint UK_8eumjccoobf7t6psn9exu4gnh; throws exception: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint UK_8eumjccoobf7t6psn9exu4gnh' at line 2 java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint UK_8eumjccoobf7t6psn9exu4gnh' at line 2 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:536) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115) at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1983) at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1936) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:891) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:795) at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [info] o.j.StatementLogger - java.sql.Statement.execute: alter table CUSTOMER add constraint UK_8eumjccoobf7t6psn9exu4gnh unique (CUSTOMER_ID); {noformat}

    Hibernate JIRA | 5 months ago | Binoy Shah
    java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint UK_8eumjccoobf7t6psn9exu4gnh' at line 2

    Root Cause Analysis

    1. java.sql.SQLSyntaxErrorException

      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order ( order_id integer not null auto_increment, address varcha' at line 1

      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException()
    2. com.mysql.cj
      StatementImpl.execute
      1. com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:686)
      2. com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:663)
      3. com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:653)
      4. com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
      5. com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2041)
      6. com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1994)
      7. com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:890)
      8. com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:788)
      8 frames
    3. 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:573)
      3. org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:557)
      4. org.hibernate.tool.schema.internal.SchemaMigratorImpl.createTable(SchemaMigratorImpl.java:345)
      5. org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:257)
      6. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:137)
      7. org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:110)
      8. org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:176)
      9. org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
      9 frames
    4. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:308)
      1 frame
    5. org.hibernate.boot
      SessionFactoryBuilderImpl.build
      1. org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:483)
      1 frame
    6. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:707)
      2. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723)
      2 frames
    7. one_to_many
      Runner.main
      1. one_to_many.Runner.main(Runner.java:15)
      1 frame