title: hibernate exception while creating a table
body: <p>Following a tutorial found on yt channel i tried to make a simple application using Hibernate. When I execute the code I get a bunch of exceptions and I can't indentify the reason why. However, results of creating a table and inserting data is visible and it works fine - this confuses me the most. Below I provide code for necessary classes, <code>persistence.xml</code> and stack trace. How can I solve this problem?</p>
  
  <pre><code>STACK TRACE:
      cze 24, 2017 7:39:31 PM org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleException
  WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
  org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
      at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
      at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:375)
      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.&lt;init&gt;(SessionFactoryImpl.java:309)
      at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
      at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
      at org.hibernate.test.Main.main(Main.java:12)
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hibernate_tests.employee' doesn't exist
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
      at com.mysql.jdbc.Util.getInstance(Util.java:408)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2444)
      at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
      at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745)
      at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
      ... 16 more
  
  cze 24, 2017 7:39:31 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
  INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@363042d7] 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.
  cze 24, 2017 7:39:31 PM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
  INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@59d2400d'
  cze 24, 2017 7:39:31 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
  INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/hibernate_tests]
  </code></pre>
  
  <p><code>persistence.xml</code></p>
  
  <pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
  version="2.0"&gt;
  &lt;persistence-unit name="myDatabase" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
      &lt;properties&gt;
          &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="javax.persistence.jdbc.user" value="miki" /&gt;
          &lt;property name="javax.persistence.jdbc.password" value="***" /&gt;
          &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/hibernate_tests" /&gt;
          &lt;property name="hibernate.dialect.storage_engine" value="innodb" /&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57Dialect" /&gt;
          &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p><code>Main.java</code></p>
  
  <pre><code>public class Main {
  
  public static void main(String[] args) {
      EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("myDatabase");
      EntityManager entityManager = entityManagerFactory.createEntityManager();
  
      Employee employee = new Employee();
      Address address = new Address();
      employee.setAddress(address);
      employee.setFirstName("aaa");
      employee.setLastName("bbb");
      employee.setSalary(10000);
  
      address.setLocalization("ccc");
      address.setStreet("ddd");
      address.setPostalCode("12-456");
  
    /*  entityManager.getTransaction().begin();
      entityManager.persist(address);
      entityManager.persist(employee);
      entityManager.getTransaction().commit();*/
  
      entityManager.close();
      entityManagerFactory.close();
  }
  
  }
  </code></pre>
  
  <p><code>Employee.java</code></p>
  
  <pre><code>@Entity
  public class Employee {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private long id;
  @Column(name = "Imie")
  private String firstName;
  @Column(name = "Nazwisko")
  private String lastName;
  @Transient
  private double salary;
  @OneToOne
  @JoinColumn
  private Address address;
  
  /*sett.&amp;gett*/
  }
  </code></pre>
  
  <p><code>Address.java</code></p>
  
  <pre><code>@Entity
  public class Address {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private long id;
  
  @Column(name = "Miejscowosc")
  private String localization;
  @Column(name = "Ulica")
  private String street;
  @Column(name = "Kod_Pocztowy")
  private String postalCode;
  /*sett.&amp;gett.*/
  </code></pre>