org.hibernate.tool.schema.spi.CommandAcceptanceException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Why Hibernate can not create table?
    via Stack Overflow by Catherine
    ,
  • 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}
    via by Binoy Shah,
  • Why getting an error when using JDBC in Java?
    via Stack Overflow by Laura G
    ,
  • Spring Boot Failing to Start Correctly
    via Stack Overflow by ashish raval
    ,
    • 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) )] at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:63) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:573) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:557) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.createTable(SchemaMigratorImpl.java:345) at org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:257) 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:65) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:308) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:483) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:707) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:723) at one_to_many.Runner.main(Runner.java:15) Caused by: 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(SQLError.java:686) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:663) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:653) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115) at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2041) at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1994) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:890) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:788) at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:51) ... 13 more

    Users with the same issue

    PilleoPilleo
    11 times, last one,
    mortalman7mortalman7
    4 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    2 more bugmates