title: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist
body: <p>I am working on <code>OneToOne</code> mapping example of <strong>Hibernate</strong> and facing following error: I am not sure what's going wrong here. Please guide.</p>
  
  <pre><code>Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' 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:422)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
      at com.mysql.jdbc.Util.getInstance(Util.java:382)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
      at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
      at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
      at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
      at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
      at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
      at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
      at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:56)
      ... 13 more
  </code></pre>
  
  <p>Vehicle.java</p>
  
  <pre><code>@Entity
  @Table(name="VEHICLE")
  public class Vehicle {
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Column(name="VEHICLE_ID")
      private Integer vehicleId;
  
      @Column(name="VEHICLE_NAME")
      private String vehicleName;
      // setter and getters
  }
  </code></pre>
  
  <p>UserDetails.java</p>
  
  <pre><code>@Entity
  @Table(name="USER_DETAIL")
  public class UserDetails {
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Column(name="USER_ID")
      private Integer userId;
  
      @Column(name="USER_NAME")
      private String userName;
  
      @OneToOne
      private Vehicle vehicle;
  
      // setters and getters
  }
  </code></pre>
  
  <p>hibernate-cfg.xml</p>
  
  <pre><code>&lt;hibernate-configuration&gt; 
      &lt;session-factory&gt; 
          &lt;!-- Database connection settings --&gt;
           &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; 
           &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/test&lt;/property&gt; 
           &lt;property name="connection.username"&gt;root&lt;/property&gt; 
           &lt;property name="connection.password"&gt;root&lt;/property&gt; 
  
          &lt;!-- JDBC connection pool (use the built-in) --&gt;
           &lt;property name="connection.pool_size"&gt;1&lt;/property&gt; 
  
          &lt;!-- SQL dialect --&gt;
           &lt;property name="dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; 
  
          &lt;!-- Enable Hibernate's automatic session context management --&gt;
            &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; 
  
          &lt;!-- Disable the second-level cache --&gt;
           &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt; 
  
          &lt;!-- Echo all executed SQL to stdout --&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt; 
  
          &lt;!-- Drop and re-create the database schema on startup --&gt;
           &lt;property name="hbm2ddl.auto"&gt;create-update&lt;/property&gt; 
  
  
           &lt;mapping class="com.sdnext.hibernate.tutorial.dto.UserDetails"/&gt;
           &lt;mapping class="com.sdnext.hibernate.tutorial.dto.Vehicle"/&gt;
  
       &lt;/session-factory&gt; 
   &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>HibernateUtil.java</p>
  
  <pre><code>public class HibernateUtil {
  
      private static final SessionFactory sessionFactory = buildSessionFactory();
  
      private static SessionFactory buildSessionFactory() {
          try {
              // Create the SessionFactory from hibernate.cfg.xml
              return new Configuration().configure().buildSessionFactory();
          } 
          catch (Throwable ex) {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
  
      public static SessionFactory getSessionFactory() {
          return sessionFactory;
      }
  
      public static void shutdown() {
          // Close caches and connection pools
          getSessionFactory().close();
      }
  }
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;properties&gt;
          &lt;java.version&gt;1.7&lt;/java.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;!-- Logging --&gt;
          &lt;logback.version&gt;1.0.13&lt;/logback.version&gt;
          &lt;slf4j.version&gt;1.7.5&lt;/slf4j.version&gt;
  
          &lt;!-- Logging --&gt;
          &lt;logback.version&gt;1.0.13&lt;/logback.version&gt;
          &lt;slf4j.version&gt;1.7.5&lt;/slf4j.version&gt;
  
          &lt;!-- Hibernate Entity Manager --&gt;
          &lt;hibernate-entitymanager.version&gt;4.2.8.Final&lt;/hibernate-entitymanager.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;5.0.7.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- MySQL database driver --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.15&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- Logging with SLF4J &amp; LogBack --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;${slf4j.version}&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.javassist&lt;/groupId&gt;
              &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;version&gt;3.20.0-GA&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;${logback.version}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;JBoss repository&lt;/id&gt;
              &lt;url&gt;http://repository.jboss.org/nexus/content/groups/public/&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;!-- Project Build --&gt;
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                      &lt;version&gt;3.1&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;source&gt;${java.version}&lt;/source&gt;
                          &lt;target&gt;${java.version}&lt;/target&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
  
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>MainApp.java</p>
  
  <pre><code>public class MainApp {
      public static void main(String[] args) {
          System.out.println("--- Hibernate One To One mapping ---");
          Session session = HibernateUtil.getSessionFactory().openSession();
  
          //SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
          session.beginTransaction();
  
          // Vehicle
          Vehicle vehicle = new Vehicle();
          vehicle.setVehicleName("Maruti Car");
  
          // User Details
          UserDetails userDetails = new UserDetails();
          userDetails.setUserName("First User");
          userDetails.setVehicle(vehicle);
  
          session.save(vehicle);
          session.save(userDetails);
  
          session.getTransaction().commit();
          session.close();
      }
  }
  </code></pre>
  
  <p>Even I tried to change <code>@GeneratedValue(strategy=GenerationType.AUTO)</code> to <code>@GeneratedValue</code>, but doesn't work. Please help to solve this issue.</p>