Commandacceptanceexception error executing ddl via jdbc statement

I really need help I searched in all the questions I found on stackoverflow and nothing works. I have never used hibernate before and I don't know what I am doing wrong. Here is my repository: http...

I really need help I searched in all the questions I found on stackoverflow and nothing works. I have never used hibernate before and I don’t know what I am doing wrong.

Here is my repository: https://github.com/ionutincau/test_db

I get this error:

"C:Program FilesJavajdk1.8.0_111binjava" "-javaagent:E:ApplicationsIntelliJIntelliJ IDEA Community Edition 2017.1libidea_rt.jar=50372:E:ApplicationsIntelliJIntelliJ IDEA Community Edition 2017.1bin" -Dfile.encoding=UTF-8 -classpath "C:Program FilesJavajdk1.8.0_111jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_111jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_111jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_111jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_111jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_111jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_111jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_111jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_111jrelibextnashorn.jar;C:Program FilesJavajdk1.8.0_111jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_111jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_111jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_111jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_111jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_111jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_111jrelibjce.jar;C:Program FilesJavajdk1.8.0_111jrelibjfr.jar;C:Program FilesJavajdk1.8.0_111jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_111jrelibjsse.jar;C:Program FilesJavajdk1.8.0_111jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_111jrelibplugin.jar;C:Program FilesJavajdk1.8.0_111jrelibresources.jar;C:Program FilesJavajdk1.8.0_111jrelibrt.jar;C:UsersionutIdeaProjectstest_dboutproductiontest_db;C:UsersionutIdeaProjectstest_dblibmysql-connector-java-5.1.41-bin.jar;C:UsersionutIdeaProjectstest_dblibhibernate-core-5.2.9.Final.jar;C:UsersionutIdeaProjectstest_dblibantlr-2.7.7.jar;C:UsersionutIdeaProjectstest_dblibclassmate-1.3.0.jar;C:UsersionutIdeaProjectstest_dblibdom4j-1.6.1.jar;C:UsersionutIdeaProjectstest_dblibhibernate-commons-annotations-5.0.1.Final.jar;C:UsersionutIdeaProjectstest_dblibhibernate-jpa-2.1-api-1.0.0.Final.jar;C:UsersionutIdeaProjectstest_dblibjandex-2.0.3.Final.jar;C:UsersionutIdeaProjectstest_dblibjavassist-3.20.0-GA.jar;C:UsersionutIdeaProjectstest_dblibjboss-logging-3.3.0.Final.jar;C:UsersionutIdeaProjectstest_dblibjboss-transaction-api_1.2_spec-1.0.1.Final.jar;C:UsersionutIdeaProjectstest_dblibhibernate-jpamodelgen-5.2.9.Final.jar" Main
Apr 03, 2017 9:05:50 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.9.Final}
Apr 03, 2017 9:05:50 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Apr 03, 2017 9:05:51 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Apr 03, 2017 9:05:51 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Apr 03, 2017 9:05:51 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/test]
Apr 03, 2017 9:05:51 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=root, password=****}
Apr 03, 2017 9:05:51 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Apr 03, 2017 9:05:51 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
Apr 03, 2017 9:05:51 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Hibernate: drop table if exists User
Apr 03, 2017 9:05:52 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@3a12c404] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Hibernate: create table User (userId integer not null, userName varchar(255), primary key (userId)) type=MyISAM
Apr 03, 2017 9:05:52 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@59b38691] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Apr 03, 2017 9:05:52 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
    at Main.main(Main.java:19)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'type=MyISAM' at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.Util.getInstance(Util.java:408)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2497)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2455)
    at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:839)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:739)
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
    ... 13 more

Apr 03, 2017 9:05:52 PM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@487db668'
Hibernate: insert into User (userName, userId) values (?, ?)
Apr 03, 2017 9:05:52 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1146, SQLState: 42S02
Apr 03, 2017 9:05:52 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Table 'test.user' doesn't exist
Apr 03, 2017 9:05:52 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release
INFO: HHH000010: On release of batch it still contained JDBC statements
Apr 03, 2017 9:05:52 PM org.hibernate.internal.ExceptionMapperStandardImpl mapManagedFlushFailure
ERROR: HHH000346: Error during managed flush [org.hibernate.exception.SQLGrammarException: could not execute statement]
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1434)
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:484)
    at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3190)
    at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2404)
    at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:467)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
    at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:220)
    at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
    at Main.main(Main.java:23)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute statement
    at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208)
    at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3003)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3503)
    at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:586)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:460)
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1428)
    ... 9 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.user' doesn't exist
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
    at com.mysql.jdbc.Util.getInstance(Util.java:408)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2501)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
    at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079)
    at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013)
    at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:205)
    ... 18 more

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Comments

@DmytroRybka

After migration to spring-boot-gradle-plugin 2.0.2 from 1.4.6 I start getting :

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: PUBLIC.USER
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) ~[hsqldb-2.4.0.jar:2.4.0]

With the 1.4.6 everything runs smooth.
Exception comes during db initialization with import.sql

spring:
  jpa:
    hibernate:
      ddl-auto: create

@snicoll
snicoll

changed the title
spring-boot-gradle-plugin 2.0.2 migration results in «Error executing DDL via JDBC Statement»

Spring Boot 2 migration results in «Error executing DDL via JDBC Statement»

Jun 5, 2018

@snicoll

Upgrading from 1.4 to 2.0 also upgrades the Hibernate version you are using (as confirmed by the snippet you’ve shared).

It is impossible for us to say if this is a problem in Spring Boot, Hibernate or your application. If you want us to investigate, please take the time to share a sample that we can clone and run ourselves.

@spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@carlosag0712

@snicoll

@carlosag0712 thanks for the feedback but that sample doesn’t look minimal and I can’t build it

[ERROR]   The project io.agileintelligence:demo:0.0.1-SNAPSHOT (/Users/snicoll/Downloads/DEVCONNECTOR-master/pom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for gravatar:gravatar:jar is missing. @ line 66, column 21

Then your sample uses the MySQL dialect with H2 (which is not going to work very well). What are the instructions to reproduce the problem?

@snicoll

from is a reserved keywords in many databases. I’ve renamed that field in both Experience and Education and the app starts fine.

@rajkumar-cp

This comment has been minimized.

@snicoll

This comment has been minimized.

I run the code to create and initialize the database, and i revice it in the console:

crea all DB
Oct 06, 2016 2:58:56 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.2.Final}
Oct 06, 2016 2:58:56 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Oct 06, 2016 2:58:56 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Oct 06, 2016 2:58:56 PM org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
Oct 06, 2016 2:58:57 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Oct 06, 2016 2:58:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Oct 06, 2016 2:58:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/oogvg?useSSL=false]
Oct 06, 2016 2:58:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=root, password=****}
Oct 06, 2016 2:58:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Oct 06, 2016 2:58:57 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 10 (min=1)
Oct 06, 2016 2:58:57 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Oct 06, 2016 2:58:58 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@6b98a075] for (non-JTA) DDL execution was not in auto-commit mode; the Connection ‘local transaction’ will be committed and the Connection will be set into auto-commit mode.
Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.cart’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.cart’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.like’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.like’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.model_article’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.model_article’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.user_new’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.user_new’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.watch’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:62)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:374)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
   at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:137)
   at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:65)
   at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:307)
   at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:490)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
   at testoodb.CreaAllDB.main(CreaAllDB.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘oogvg.watch’ doesn’t exist
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
   at com.mysql.jdbc.Util.getInstance(Util.java:383)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2783)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:908)
   at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:788)
   at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:49)
   … 14 more

Oct 06, 2016 2:58:58 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@1951b871] for (non-JTA) DDL execution was not in auto-commit mode; the Connection ‘local transaction’ will be committed and the Connection will be set into auto-commit mode.
Oct 06, 2016 2:59:08 PM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
INFO: HHH000476: Executing import script ‘org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@2974f221’
Done

checking the database, it would seem to initialize properly.

possible that the error is because i save some objects more than once time?
some objects are stored in more lists of other objects, so i used several session.save(…)

how to resolve error executing ddl commands in spring boot

Hi I am new to spring Boot and i created new project(Demo) using spring initilizr Project structure is Project : Maven Project Language : Java Spring Boot : 2.4.2

application.propertites file is like

server.port=8084   
spring.datasource.url=jdbc:postgresql://localhost:5432/demodb  
spring.datasource.username=postgres spring.datasource.password=root 
spring.jpa.hibernate.ddl-auto=update   
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 
spring.jpa.show-sql=true   
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

I have Created some classes and controllers :

Entity

@Entity
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Integer id;

    @Column(name = "user_name")
    private String userName;

    @Column(name = "email")
    private String email;
}

Repository :

@Repository
public interface UserRepository extends CrudRepository<User, Integer> {

}

Service :

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;
    @Autowired
    private ObjectMapper objectMapper;

    public ResponseEntity addUser(JsonNode userData) {
        User user  = objectMapper.convertValue(userData, User.class);
        userRepository.save(user);
        return ResponseEntity.ok(userData);
    }

Controller :

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/adduser")
    public ResponseEntity addUser(@RequestBody JsonNode userData){
        return userService.addUser(userData);
    }
}

But when i run the program i got error related to DB command : DLL command syntax error
as i am new to this framework i am not sure why this error is ? here are logs i am getting
error logs :

2021-02-10 12:09:55.296  WARN 14681 --- [           main] o.h.t.s.i.ExceptionHandlerLoggedImpl     : GenerationTarget encountered exception accepting command : Error executing DDL "create table user (id int4 not null, email varchar(255), user_name varchar(255), primary key (id))" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table user (id int4 not null, email varchar(255), user_name varchar(255), primary key (id))" via JDBC Statement
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:559) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:504) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:277) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:184) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:316) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:469) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) ~[spring-orm-5.3.3.jar:5.3.3]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.3.3.jar:5.3.3]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[spring-orm-5.3.3.jar:5.3.3]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-5.3.3.jar:5.3.3]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.3.jar:5.3.3]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159) ~[spring-context-5.3.3.jar:5.3.3]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) ~[spring-context-5.3.3.jar:5.3.3]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.3.jar:5.3.3]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.2.jar:2.4.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.2.jar:2.4.2]
    at com.note.noteShare.NoteShareApplication.main(NoteShareApplication.java:10) ~[classes/:na]
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "user"
  Position: 14
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284) ~[postgresql-42.2.18.jar:42.2.18]
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:279) ~[postgresql-42.2.18.jar:42.2.18]
    at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-3.4.5.jar:na]
    at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-3.4.5.jar:na]
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
    ... 35 common frames omitted

Advertisement

Answer

user is a reserved keyword in postgresql. Change your table name to something else, for example:

@Entity
@Table(name = "users")
public class User {

10 People found this is helpful

Error code:

Hibernate: create table course (id integer not null auto_increment, index integer, name varchar(255), primary key (id)) engine=InnoDB
Oct 12, 2021 4:31:05 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL "create table course (id integer not null auto_increment, index integer, name varchar(255), primary key (id)) engine=InnoDB" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table course (id integer not null auto_increment, index integer, name varchar(255), primary key (id)) engine=InnoDB" via JDBC Statement
...

Hibernate: create table student (id integer not null auto_increment, name varchar(255), primary key (id)) engine=InnoDB
...

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 'integer, name varchar(255), primary key (id)) engine=InnoDB' at line 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:762)
	at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:646)
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
	... 36 more

Finally, I found that the problem is that an attribute name of my Course class is index, and this is a keyword in MySQL

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "course")
@ManagedBean(name = "course")
public class Course {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;
    private Integer index;

    @ManyToMany(mappedBy = "courseList")
    private List<Student> studentList;

}

Just change the name of index

Summary: attribute names of entity classes should not be keywords in the database

Read More:

This issue SyntaxErrorException for type MyISAM is occurred because of dialect selected for hibernate. Let’s consider my example and the issue occurred because of that.

Hibernate Configuration

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

As we know in the hibernate configured dialect decide the query generation as per database.

Query Generated

create table ADDRESS (
       id integer not null auto_increment,
        street_name varchar(255),
        city_name varchar(255),
        state_name varchar(255),
        zipcode varchar(255),
        primary key (id)
    ) type=MyISAM

Exception Stack Trace

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
 at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
 at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
 at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
 at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
 at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)
 at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:710)
 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
 at com.facingissuesonit.persistent.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
 at com.facingissuesonit.persistent.HibernateUtil.(HibernateUtil.java:8)
 at com.facingissuesonit.App.main(App.java:26)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'type=MyISAM' at line 8
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
 at com.mysql.jdbc.Util.getInstance(Util.java:381)

Solutions

As given above the problem is that the dialect org.hibernate.dialect.MySQLDialect is configured which is for MySQL 4.x or earlier version and we are pointing to MY SQL database with the newer version.

The query generated by dialect having to fragment TYPE=MyISAM that was deprecated in MySQL 4.0 and removed in 5.5. Earlier MySQL 4.x.x version use TYPE MyISAM engine used to store tables but in MySQL 5.x.x or later version MySQL is used ENGINE = MyISAM to store tables. e.g. thats make difference while hibernate generates queries.

As per the database configured for MySQL, we should use other dialects as per database configured. Here is the complete list of Hibernate dialects as per databases:

Hibernate: SQL Dialects List

For Example:
In MySQL <= 4.x.x use dialects as below

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

In MySQL>=5.x.x. use dialects as below

<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>

I am a novice in hibernate world and facing,

WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement

exception while I run my stand-alone programe in hibernate 5.2.9 version. But in hibernate 4 version all my code runs well. I looked for many questions and solve but not working answer i got.

Configuration file

hibernate.cfg.xml

    <hibernate-configuration>
      <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">admin</property>
        <property name="hibernate.connection.pool_size">20</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.hbm2ddl.auto">create</property>
        <mapping class="com.test.hibernate14417.MyTable"></mapping>
      </session-factory>
    </hibernate-configuration>

Pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test</groupId>
    <artifactId>Hibernate14417</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <repositories>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.9.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>3.1.11</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

Utility file

package com.test.hibernate14417;

import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.service.ServiceRegistry;


public class ExecuteUtil {
    private static final SessionFactory SESSION_FACTORY=buildSessionFactory();

    private static SessionFactory buildSessionFactory() {
        try {
            ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
                    .configure("hibernate.cfg.xml").build();

            Metadata metadata = new MetadataSources(serviceRegistry).buildMetadata();

            return metadata.getSessionFactoryBuilder().build();

        } catch (Throwable ex) {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }

    }

    public static SessionFactory getSESSION_FACTORY() {
        return SESSION_FACTORY;
    }

    public static void shutdown(){
        getSESSION_FACTORY().close();
    }

}

Entity file

package com.test.hibernate14417;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;




@Entity
public class MyTable implements Serializable {

    @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    private String name;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



}

Main method

package com.test.hibernate14417;

import org.hibernate.Session;
import org.hibernate.SessionFactory;


public class Main {
    public static void main(String[] args) {

        MyTable mt=new MyTable();
        mt.setName("Man");

        SessionFactory sessionFactory=ExecuteUtil.getSESSION_FACTORY();

        Session session=sessionFactory.getCurrentSession();


        try {
          session.getTransaction().begin();

          session.save(mt);

          session.getTransaction().commit();

           session.close();
           sessionFactory.close();

        } catch (Exception e) {
            System.out.println(e.getStackTrace());
            session.getTransaction().rollback();
        }


    }

Console

cd D:NetbeansHibernate14417; "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121" cmd /c """C:\Program Files\NetBeans 8.2\java\maven\bin\mvn.bat" -Dexec.args="-classpath %classpath com.test.hibernate14417.Main" -Dexec.executable="C:\Program Files\Java\jdk1.8.0_121\bin\java.exe" -Dmaven.ext.class.path="C:\Program Files\NetBeans 8.2\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec""
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...

------------------------------------------------------------------------
Building Hibernate14417 1.0-SNAPSHOT
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ Hibernate14417 ---
Apr 14, 2017 10:41:51 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.9.Final}
Apr 14, 2017 10:41:51 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Apr 14, 2017 10:41:53 AM org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
Apr 14, 2017 10:41:54 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Apr 14, 2017 10:41:54 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Apr 14, 2017 10:41:54 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/test]
Apr 14, 2017 10:41:54 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=root, password=****}
Apr 14, 2017 10:41:54 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Apr 14, 2017 10:41:54 AM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Apr 14, 2017 10:41:55 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Apr 14, 2017 10:41:55 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl useContextualLobCreation
INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
Hibernate: drop table if exists hibernate_sequence
Apr 14, 2017 10:41:58 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@24111ef1] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Hibernate: drop table if exists MyTable
Hibernate: create table hibernate_sequence (next_val bigint) type=MyISAM
Apr 14, 2017 10:41:58 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@531f4093] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Apr 14, 2017 10:41:58 AM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
    at com.test.hibernate14417.ExecuteUtil.buildSessionFactory(ExecuteUtil.java:29)
    at com.test.hibernate14417.ExecuteUtil.<clinit>(ExecuteUtil.java:20)
    at com.test.hibernate14417.Main.main(Main.java:21)
Caused by: java.sql.SQLException: 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 'type=MyISAM' at line 1
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
    at com.mysql.jdbc.Statement.execute(Statement.java:529)
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
    ... 13 more

Hibernate: insert into hibernate_sequence values ( 1 )
Apr 14, 2017 10:41:58 AM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
    at com.test.hibernate14417.ExecuteUtil.buildSessionFactory(ExecuteUtil.java:29)
    at com.test.hibernate14417.ExecuteUtil.<clinit>(ExecuteUtil.java:20)
    at com.test.hibernate14417.Main.main(Main.java:21)
Caused by: java.sql.SQLException: Table 'test.hibernate_sequence' doesn't exist
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
    at com.mysql.jdbc.Statement.execute(Statement.java:529)
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
    ... 13 more

Hibernate: create table MyTable (id integer not null, name varchar(255), primary key (id)) type=MyISAM
Apr 14, 2017 10:41:58 AM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:440)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:424)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:315)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:155)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)
    at com.test.hibernate14417.ExecuteUtil.buildSessionFactory(ExecuteUtil.java:29)
    at com.test.hibernate14417.ExecuteUtil.<clinit>(ExecuteUtil.java:20)
    at com.test.hibernate14417.Main.main(Main.java:21)
Caused by: java.sql.SQLException: 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 'type=MyISAM' at line 1
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
    at com.mysql.jdbc.Statement.execute(Statement.java:529)
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
    ... 13 more

Apr 14, 2017 10:41:58 AM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@7776ab'
Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!
    at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:454)
    at com.test.hibernate14417.Main.main(Main.java:23)

Answer

You should try a different dialects likeorg.hibernate.dialect.MySQL5Dialect OR org.hibernate.dialect.MySQLMyISAMDialect OR org.hibernate.dialect.MySQLInnoDBDialect to see which one works for you.

All in all , your current dialect is generating , type=MyISAM while it should be , ENGINE=MyISAM in create table query.

mysql error ‘TYPE=MyISAM’

You should read this too , Why do I need to configure the SQL dialect of a data source?

Your logs say that this query was tried to be executed , create table MyTable (id integer not null, name varchar(255), primary key (id)) type=MyISAM so you should try to execute that query directly on mysql command prompt to see if that works for your MySQL version.

Also, in question do specify your MySQL version too.

Hope it helps !!

Attribution
Source : Link , Question Author : John , Answer Author : Community

Понравилась статья? Поделить с друзьями:
  • Command returned error bitrix smtp
  • Command raised an exception httpexception 400 bad request error code 50035 invalid form body
  • Command raised an exception forbidden 403 forbidden error code 50013 missing permissions
  • Command python select linter resulted in an error command python setlinter not found
  • Command python select interpreter resulted in an error