Generationtarget encountered exception accepting command error executing ddl via jdbc statement

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.

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)

REPRODUCED:

Configuring Spring Security Core ...
... finished configuring Spring Security Core

[2019-10-02 15:58:36.253]  WARN StandardDialectResolver --- [           main] HHH000385: Unknown Microsoft SQL Server major version [14] using [class org.hibernate.dialect.SQLServer2012Dialect] dialect
Hibernate: create table webhook (id bigint identity not null, version bigint not null, event_plugin varchar(255) not null, plugin_configuration_json varchar(MAX) not null, name varchar(255) not null, enabled bit default true not null, project varchar(255) not null, auth_token varchar(255) not null, primary key (id))
[2019-10-02 15:58:38.618]  WARN ExceptionHandlerLoggedImpl --- [           main] 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.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:524)
        at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470)
        at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:273)
        at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)
        at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:203)
        at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.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:478)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:423)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
        at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:276)
        at org.grails.orm.hibernate.connections.HibernateConnectionSourceFactory.create(HibernateConnectionSourceFactory.java:86)
        at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:39)
        at org.grails.orm.hibernate.connections.AbstractHibernateConnectionSourceFactory.create(AbstractHibernateConnectionSourceFactory.java:23)
        at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:64)
        at org.grails.datastore.mapping.core.connections.AbstractConnectionSourceFactory.create(AbstractConnectionSourceFactory.java:52)
        at org.grails.datastore.mapping.core.connections.ConnectionSourcesInitializer.create(ConnectionSourcesInitializer.groovy:24)
        at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:201)
        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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1197)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:648)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:145)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1197)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:928)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:805)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:573)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:432)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
        at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:206)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1260)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1094)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1059)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1177)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:225)
        at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:703)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:84)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:393)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:380)
        at grails.boot.GrailsApp$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)
        at rundeckapp.Application.main(Application.groovy:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The name "true" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:259)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1547)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:857)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:757)
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7344)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2713)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:224)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:204)
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.execute(SQLServerStatement.java:734)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
        at com.sun.proxy.$Proxy81.execute(Unknown Source)
        at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
        ... 83 common frames omitted

[2019-10-02 15:58:49.680]  INFO BootStrap --- [           main] Starting Rundeck 3.1.2-20190927 (2019-09-27) ...
[2019-10-02 15:58:49.680]  INFO BootStrap --- [           main] using rdeck.base config property: C:/Users/Public/rundeck-oss
[2019-10-02 15:58:49.696]  INFO BootStrap --- [           main] loaded configuration: C:UsersPublicrundeck-ossetcframework.properties
[2019-10-02 15:58:49.743]  INFO BootStrap --- [           main] RSS feeds disabled
[2019-10-02 15:58:49.743]  INFO BootStrap --- [           main] Using builtin realm authentication
[2019-10-02 15:58:49.743]  INFO BootStrap --- [           main] Preauthentication is disabled
[2019-10-02 15:58:49.743]  WARN BootStrap --- [           main] Feature 'cleanExecutionHistoryJob' is enabled
Hibernate: select this_.name as y0_ from project this_
[2019-10-02 15:58:49.915]  INFO BootStrap --- [           main] Rundeck is ACTIVE: executions can be run.
[2019-10-02 15:58:49.915]  WARN BootStrap --- [           main] The JVM default encoding is not UTF-8: windows-1252, you may not see output as expected for multibyte locales. Specify -Dfile.encoding=UTF-8 in the JVM options.
Hibernate: select this_.id as y0_ from execution this_ where this_.date_started is not null and this_.date_completed is null and this_.server_nodeuuid is null and this_.date_started<? and (this_.status is null or this_.status<>?)
[2019-10-02 15:58:50.008]  INFO BootStrap --- [           main] Rundeck startup finished in 468ms
Grails application running at http://node01.rundeck.local:4440 in environment: production
Hibernate: select this_.id as id1_3_0_, this_.version as version2_3_0_, this_.date_created as date_cre3_3_0_, this_.uuid as uuid4_3_0_, this_.last_updated as last_upd5_3_0_, this_.[SIZE] as SIZE6_3_0_, this_.record_name as record_n7_3_0_, this_.storage_reference as storage_8_3_0_, this_.file_state as file_sta9_3_0_, this_.file_name as file_na10_3_0_, this_.storage_type as storage11_3_0_, this_.storage_meta as storage12_3_0_, this_.record_type as record_13_3_0_, this_.execution_id as executi14_3_0_, this_.server_nodeuuid as server_15_3_0_, this_.rduser as rduser16_3_0_, this_.job_id as job_id17_3_0_, this_.sha as sha18_3_0_, this_.project as project19_3_0_, this_.expiration_date as expirat20_3_0_ from job_file_record this_ where this_.expiration_date<=? and this_.file_state=? and this_.server_nodeuuid is null
Hibernate: select this_.id as id1_15_0_, this_.version as version2_15_0_, this_.log_output_threshold as log_outp3_15_0_, this_.do_nodedispatch as do_noded4_15_0_, this_.next_execution as next_exe5_15_0_, this_.date_created as date_cre6_15_0_, this_.node_keepgoing as node_kee7_15_0_, this_.node_exclude_os_arch as node_exc8_15_0_, this_.uuid as uuid9_15_0_, this_.node_include as node_in10_15_0_, this_.success_on_empty_node_filter as success11_15_0_, this_.node_exclude_os_version as node_ex12_15_0_, this_.timeout as timeout13_15_0_, this_.node_exclude_precedence as node_ex14_15_0_, this_.node_exclude_name as node_ex15_15_0_, this_.notify_avg_duration_threshold as notify_16_15_0_, this_.day_of_week as day_of_17_15_0_, this_.node_include_os_version as node_in18_15_0_, this_.node_exclude_os_name as node_ex19_15_0_, this_.retry as retry20_15_0_, this_.filter as filter21_15_0_, this_.group_path as group_p22_15_0_, this_.scheduled as schedul23_15_0_, this_.orchestrator_id as orchest24_15_0_, this_.node_threadcount_dynamic as node_th25_15_0_, this_.node_include_name as node_in26_15_0_, this_.multiple_executions as multipl27_15_0_, this_.time_zone as time_zo28_15_0_, this_.rduser as rduser29_15_0_, this_.node_include_os_name as node_in30_15_0_, this_.filter_exclude as filter_31_15_0_, this_.node_exclude as node_ex32_15_0_, this_.node_rank_order_ascending as node_ra33_15_0_, this_.nodes_selected_by_default as nodes_s34_15_0_, this_.node_include_os_arch as node_in35_15_0_, this_.loglevel as logleve36_15_0_, this_.node_exclude_os_family as node_ex37_15_0_, this_.execution_enabled as executi38_15_0_, this_.max_multiple_executions as max_mul39_15_0_, this_.node_include_os_family as node_in40_15_0_, this_.last_updated as last_up41_15_0_, this_.retry_delay as retry_d42_15_0_, this_.workflow_id as workflo43_15_0_, this_.exec_count as exec_co44_15_0_, this_.month as month45_15_0_, this_.hour as hour46_15_0_, this_.log_output_threshold_action as log_out47_15_0_, this_.arg_string as arg_str48_15_0_, this_.user_role_list as user_ro49_15_0_, this_.total_time as total_t50_15_0_, this_.node_rank_attribute as node_ra51_15_0_, this_.server_nodeuuid as server_52_15_0_, this_.default_tab as default53_15_0_, this_.node_exclude_tags as node_ex54_15_0_, this_.seconds as seconds55_15_0_, this_.exclude_filter_uncheck as exclude56_15_0_, this_.ref_exec_count as ref_exe57_15_0_, this_.node_threadcount as node_th58_15_0_, this_.node_include_tags as node_in59_15_0_, this_.job_name as job_nam60_15_0_, this_.schedule_enabled as schedul61_15_0_, this_.year as year62_15_0_, this_.day_of_month as day_of_63_15_0_, this_.node_filter_editable as node_fi64_15_0_, this_.log_output_threshold_status as log_out65_15_0_, this_.description as descrip66_15_0_, this_.minute as minute67_15_0_, this_.project as project68_15_0_ from scheduled_execution this_ where this_.scheduled=?
Hibernate: select this_.id as id1_4_1_, this_.version as version2_4_1_, this_.plugin_name as plugin_n3_4_1_, this_.date_created as date_cre4_4_1_, this_.filetype as filetype5_4_1_, this_.last_updated as last_upd6_4_1_, this_.completed as complete7_4_1_, this_.execution_id as executio8_4_1_, execution_1_.id as id1_2_0_, execution_1_.version as version2_2_0_, execution_1_.scheduled_execution_id as schedule3_2_0_, execution_1_.do_nodedispatch as do_noded4_2_0_, execution_1_.node_exclude_os_arch as node_exc5_2_0_, execution_1_.node_keepgoing as node_kee6_2_0_, execution_1_.succeeded_node_list as succeede7_2_0_, execution_1_.retry_attempt as retry_at8_2_0_, execution_1_.node_include as node_inc9_2_0_, execution_1_.success_on_empty_node_filter as success10_2_0_, execution_1_.node_exclude_os_version as node_ex11_2_0_, execution_1_.timeout as timeout12_2_0_, execution_1_.node_exclude_precedence as node_ex13_2_0_, execution_1_.node_exclude_name as node_ex14_2_0_, execution_1_.node_include_os_version as node_in15_2_0_, execution_1_.node_exclude_os_name as node_ex16_2_0_, execution_1_.retry as retry17_2_0_, execution_1_.filter as filter18_2_0_, execution_1_.orchestrator_id as orchest19_2_0_, execution_1_.node_include_name as node_in20_2_0_, execution_1_.rduser as rduser21_2_0_, execution_1_.retry_original_id as retry_o22_2_0_, execution_1_.execution_type as executi23_2_0_, execution_1_.node_include_os_name as node_in24_2_0_, execution_1_.abortedby as aborted25_2_0_, execution_1_.filter_exclude as filter_26_2_0_, execution_1_.node_exclude as node_ex27_2_0_, execution_1_.node_rank_order_ascending as node_ra28_2_0_, execution_1_.node_include_os_arch as node_in29_2_0_, execution_1_.loglevel as logleve30_2_0_, execution_1_.node_exclude_os_family as node_ex31_2_0_, execution_1_.node_include_os_family as node_in32_2_0_, execution_1_.cancelled as cancell33_2_0_, execution_1_.retry_delay as retry_d34_2_0_, execution_1_.workflow_id as workflo35_2_0_, execution_1_.timed_out as timed_o36_2_0_, execution_1_.failed_node_list as failed_37_2_0_, execution_1_.arg_string as arg_str38_2_0_, execution_1_.user_role_list as user_ro39_2_0_, execution_1_.node_rank_attribute as node_ra40_2_0_, execution_1_.date_completed as date_co41_2_0_, execution_1_.outputfilepath as outputf42_2_0_, execution_1_.server_nodeuuid as server_43_2_0_, execution_1_.will_retry as will_re44_2_0_, execution_1_.retry_execution_id as retry_e45_2_0_, execution_1_.node_exclude_tags as node_ex46_2_0_, execution_1_.exclude_filter_uncheck as exclude47_2_0_, execution_1_.node_threadcount as node_th48_2_0_, execution_1_.node_include_tags as node_in49_2_0_, execution_1_.date_started as date_st50_2_0_, execution_1_.status as status51_2_0_, execution_1_.node_filter_editable as node_fi52_2_0_, execution_1_.project as project53_2_0_ from log_file_storage_request this_ inner join execution execution_1_ on this_.execution_id=execution_1_.id where this_.completed=? and (execution_1_.server_nodeuuid is null)
Hibernate: select this_.id as id1_2_0_, this_.version as version2_2_0_, this_.scheduled_execution_id as schedule3_2_0_, this_.do_nodedispatch as do_noded4_2_0_, this_.node_exclude_os_arch as node_exc5_2_0_, this_.node_keepgoing as node_kee6_2_0_, this_.succeeded_node_list as succeede7_2_0_, this_.retry_attempt as retry_at8_2_0_, this_.node_include as node_inc9_2_0_, this_.success_on_empty_node_filter as success10_2_0_, this_.node_exclude_os_version as node_ex11_2_0_, this_.timeout as timeout12_2_0_, this_.node_exclude_precedence as node_ex13_2_0_, this_.node_exclude_name as node_ex14_2_0_, this_.node_include_os_version as node_in15_2_0_, this_.node_exclude_os_name as node_ex16_2_0_, this_.retry as retry17_2_0_, this_.filter as filter18_2_0_, this_.orchestrator_id as orchest19_2_0_, this_.node_include_name as node_in20_2_0_, this_.rduser as rduser21_2_0_, this_.retry_original_id as retry_o22_2_0_, this_.execution_type as executi23_2_0_, this_.node_include_os_name as node_in24_2_0_, this_.abortedby as aborted25_2_0_, this_.filter_exclude as filter_26_2_0_, this_.node_exclude as node_ex27_2_0_, this_.node_rank_order_ascending as node_ra28_2_0_, this_.node_include_os_arch as node_in29_2_0_, this_.loglevel as logleve30_2_0_, this_.node_exclude_os_family as node_ex31_2_0_, this_.node_include_os_family as node_in32_2_0_, this_.cancelled as cancell33_2_0_, this_.retry_delay as retry_d34_2_0_, this_.workflow_id as workflo35_2_0_, this_.timed_out as timed_o36_2_0_, this_.failed_node_list as failed_37_2_0_, this_.arg_string as arg_str38_2_0_, this_.user_role_list as user_ro39_2_0_, this_.node_rank_attribute as node_ra40_2_0_, this_.date_completed as date_co41_2_0_, this_.outputfilepath as outputf42_2_0_, this_.server_nodeuuid as server_43_2_0_, this_.will_retry as will_re44_2_0_, this_.retry_execution_id as retry_e45_2_0_, this_.node_exclude_tags as node_ex46_2_0_, this_.exclude_filter_uncheck as exclude47_2_0_, this_.node_threadcount as node_th48_2_0_, this_.node_include_tags as node_in49_2_0_, this_.date_started as date_st50_2_0_, this_.status as status51_2_0_, this_.node_filter_editable as node_fi52_2_0_, this_.project as project53_2_0_ from execution this_ where this_.status=?
[2019-10-02 15:58:56.790]  INFO BootStrap --- [      Thread-14] Rundeck Shutdown detected

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:

Introduction

In this article, we are going to see how you can escape SQL reserved keywords with JPA and Hibernate.

I decided to write this article because I keep on seeing this problem on the Hibernate forum or StackOverflow.

How to escape SQL reserved keywords with JPA and #Hibernate@vlad_mihalcea https://t.co/Pyi6u9pR3k pic.twitter.com/d1eLcCeMe3

— Java (@java) February 2, 2019

Reserved keywords

Because SQL is a declarative language, the keywords that form the grammar of the language are reserved for internal use, and they cannot be employed when defining a database identifier (e.g., catalog, schema, table, column name).

Now, since each relational database provides a custom SQL dialect, the list of reserved keywords may differ from one database to another, as illustrated by the following list:

  • Oracle
  • SQL Server
  • PostgreSQL
  • MySQL

Domain Model

Let’s assume that we are developing the application we are developing is required to store information about database tables. Therefore, we can use the following Table entity:

Table entity

Now, if we map the Table entity like this:

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

    @Id
    @GeneratedValue
    private Long id;

    private String catalog;

    private String schema;

    private String name;

    @Column(name = "desc")
    private String description;

    //Getters and setters omitted for brevity
}

And, we try to generate the database schema using the hbm2ddl tool, the schema generation process will fail as follows:

Caused by: org.hibernate.tool.schema.spi.CommandAcceptanceException: 
	Error executing DDL "create table Table (id bigint not null, catalog varchar(255), desc varchar(255), name varchar(255), schema varchar(255), primary key (id))" via JDBC Statement
Caused by: java.sql.SQLSyntaxErrorException: 
	unexpected token: TABLE

Because the TABLE keyword is reserved, we need to escape it. More, we need to escape the catalog, schema, and desc column names since these are also reserved by the database.

Manual escaping using the JPA column name attribute

The first option you have to escape a database identifier is to wrap the table or column name using the double quote sign (e.g., “) as illustrated by the following JPA entity mapping:

@Entity(name = "Table")
@javax.persistence.Table(name = ""Table"")
public class Table {

    @Id
    @GeneratedValue
    private Long id;

    @Column(name = ""catalog"")
    private String catalog;

    @Column(name = ""schema"")
    private String schema;

    private String name;

    @Column(name = ""desc"")
    private String description;

    //Getters and setters omitted for brevity
}

Now, when generating the database schema using the hbm2ddl tool, Hibernate is going to generate the following DDL statement:

CREATE TABLE "table" (
    id bigint NOT NULL,
    "catalog" VARCHAR(255),
    "desc" VARCHAR(255),
    name VARCHAR(255),
    "schema" VARCHAR(255),
    PRIMARY KEY (id)
)

Notice that the table name, as well as the columns using SQL reserved keywords, are properly escaped this time.

When persisting a Table entity:

entityManager.persist(
    new Table()
    .setCatalog("library")
    .setSchema("public")
    .setName("book")
    .setDescription(
        "The book table stores book-related info"
    )
);

Hibernate generates the proper SQL INSERT statement:

INSERT INTO "table" (
    "catalog",
    "desc",
    name,
    "schema",
    id
)
VALUES (
    'library',
    'The book table stores book-related info',
    'book',
    'public',
    1
)

Notice that the Table entity creation uses the Fluent-style API pattern. For more details about building JPA entities using the Fluent-style API, check out this article.

When fetching the Table entity:

List<Table> tables = entityManager.createQuery(
    "select t " +
    "from Table t " +
    "where t.description like :description", Table.class)
.setParameter("description", "%book%")
.getResultList();

assertEquals(1, tables.size());

Hibernate escapes all database identifiers we have explicitly escaped in the JPA entity mapping:

SELECT 
    t.id AS id1_0_,
    t."catalog" AS catalog2_0_,
    t."desc" AS desc3_0_,
    t.name AS name4_0_,
    t."schema" AS schema5_0_
FROM 
    "table" t
WHERE 
    t."desc" LIKE '%book%'

Manual escaping using the Hibernate-specific backtick character

You can also escape a given database object qualifier using the backtick (e.g., `) character.

@Entity(name = "Table")
@javax.persistence.Table(name = "`table`")
public class Table {

    @Id
    @GeneratedValue
    private Long id;

    @Column(name = "`catalog`")
    private String catalog;

    @Column(name = "`schema`")
    private String schema;

    @Column(name = "`name`")
    private String name;

    @Column(name = "`desc`")
    private String description;

    //Getters and setters omitted for brevity
}

The Hibernate-specific backtick escape is equivalent to the JPA double-quotes escape character, so all the generated DDL or DML statements are exactly as in the previous section.

Global escaping using the Hibernate globally_quoted_identifiers property

Another option is to set the hibernate.globally_quoted_identifiers property to true in the persistence.xml configuration file:

<property 
    name="hibernate.globally_quoted_identifiers" 
    value=true"
/>

This way, Hibernate is going to escape all database identifiers, meaning that we don’t need to manually escape the table or column names:

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

    @Id
    @GeneratedValue
    private Long id;

    private String catalog;

    private String schema;

    private String name;

    @Column(name = "desc")
    private String description;

    //Getters and setters omitted for brevity
}

When generating the database schema, Hibernate is going to escape the table name as well as all columns:

CREATE TABLE "Table" (
    "id" bigint NOT NULL,
    "catalog" VARCHAR(255),
    "desc" VARCHAR(255),
    "name" VARCHAR(255),
    "schema" VARCHAR(255),
    PRIMARY KEY ("id")
)

When persisting the Table entity, the SQL INSERT statement will automatically escape the table and the column names:

INSERT INTO "table" (
    "catalog",
    "desc",
    "name",
    "schema",
    "id"
)
VALUES (
    'library',
    'The book table stores book-related info',
    'book',
    'public',
    1
)

Notice that even the id and name column names are escaped this time.

The same applies to any SQL statement generated by Hibernate, so fetching the Table entities matching the provided description generates the following SQL SELECT query:

SELECT 
    t."id" AS id1_0_,
    t."catalog" AS catalog2_0_,
    t."desc" AS desc3_0_,
    t."name" AS name4_0_,
    t."schema" AS schema5_0_
FROM 
    "table" t
WHERE 
    t."desc" LIKE '%book%'

Enabling the Hibernate globally_quoted_identifiers_skip_column_definitions property

Now, let’s assume we need to provide a custom DDL definition for a given table column, as illustrated by the following code snippet:

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

	@Id
	@GeneratedValue
	@Column(columnDefinition = "smallint")
	private Integer id;

	private String catalog;

	private String schema;

	private String name;

	private String description;

    //Getters and setters omitted for brevity
}

If the hibernate.globally_quoted_identifiers property is enabled and we try to generate the database schema using hbm2ddl, Hibernate is going to throw the following exception:

CREATE TABLE "Table" (
    "id" "smallint" NOT NULL,
    "catalog" VARCHAR(255),
    "desc" VARCHAR(255),
    "name" VARCHAR(255),
    "schema" VARCHAR(255),
    PRIMARY KEY ("id")
)
    
-- GenerationTarget encountered exception accepting command : 
    Error executing DDL via JDBC Statement

The problem is caused by the explicit definition of the table Primary Key column that got escaped as well. Notice the double-quoted "smallint" column type associated with the id column.

To fix this issue, we need to also enable the hibernate.globally_quoted_identifiers_skip_column_definitions configuration property:

<property 
    name="hibernate.globally_quoted_identifiers_skip_column_definitions" 
    value=true"
/>

Now, Hibernate skips quoting the explicit column definition, and everything will work just fine:

CREATE TABLE "Table" (
    "id" smallint NOT NULL,
    "catalog" VARCHAR(255),
    "desc" VARCHAR(255),
    "name" VARCHAR(255),
    "schema" VARCHAR(255),
    PRIMARY KEY ("id")
)

The list of reserved words, that are skipped by Hibernate when setting the hibernate.globally_quoted_identifiers_skip_column_definitions property, are taken from the following sources:

  • java.sql.DatabaseMetaData.getSQLKeywords() provided by the current JDBC Driver,
  • the ANSI SQL keywords defined by the Hibernate org.hibernate.engine.jdbc.env.spi.AnsiSqlKeywords class,
  • the Dialect-specific keywords defined by the sqlKeywords Set in the Hibernate Dialect Object instance.

Although you could automatically quote all identifiers, in reality, it’s much better if you escape only those database objects that include a reserved keyword. This will provide better control than the automatic quoting strategies.

If you enjoyed this article, I bet you are going to love my Book and Video Courses as well.

And there is more!

You can earn a significant passive income stream from promoting all these amazing products that I have been creating.

If you’re interested in supplementing your income, then join my affiliate program.

Conclusion

Escaping SQL reserved keywords is straightforward when using JPA and Hibernate. While the JPA column-level escaping is very useful if you only have a small number of database identifiers to be escaped, when the number of database identifiers using reserved keywords is large, the Hibernate global escaping becomes a very convenient alternative.

Transactions and Concurrency Control eBook

Earn Passive Income!

Hypersistence Optimizer rocks!

Всем привет, при запуске проекта хибернейт вываливает огромную простыню эксепшенов:

15-Jan-2017 12:51:11.109 INFO [RMI TCP Connection(2)-127.0.0.1] org.hibernate.validator.internal.util.Version.<clinit> HV000001: Hibernate Validator 5.3.4.Final
Hibernate: alter table public.user_role drop constraint FKa68196081fvovjhkek5m97n3y
15-Jan-2017 12:51:12.168 WARN [RMI TCP Connection(2)-127.0.0.1] org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl.handleException 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.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:144)
	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 org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:511)
	at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:495)

Настроено удаление и создание таблиц при запуске проекта:
35626103bdd844f785f883e2686069de.png

Связь между таблицами ManyToMany.
Таблица user:

@ManyToMany(fetch = FetchType.EAGER, targetEntity = Role.class, cascade = {CascadeType.ALL})
    @JoinTable(name = "user_role", joinColumns = {@JoinColumn(name = "user_id")},
            inverseJoinColumns = {@JoinColumn(name = "role_id")})
    private Set<Role> roles;

Таблица role:

@ManyToMany(fetch = FetchType.EAGER, mappedBy = "roles")
    private List<User> users;

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Generation zero как изменить язык
  • Generation zero f has stopped working как исправить
  • Generating dungeon terraria tremor error
  • Generals ошибка game dat
  • Generals zero hour ошибка синхронизации

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии