title: cannot run hibernate with EntityManager
body: <p>I am trying to run a simple hello world program as given in "Java Persistence with Hibernate" book by Cristian Bauer &amp; Gavin King. Only change I made was to change the database from HSQLDB to MySQL.Code is immaterial because things work when I use hibernate with SessionFactory or Annotaion.
  The Log says it could not find the table. Here is my persistence.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" 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"&gt;
  &lt;persistence-unit name="helloworld" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;class&gt;hello.Message&lt;/class&gt;
      &lt;properties&gt;
          &lt;property name="hibernate.archive.autodetection" value="class, hbm"/&gt;
          &lt;property name="hibernate.show_sql" value="true"/&gt;
          &lt;property name="hibernate.format_sql" value="true"/&gt;
          &lt;property name="use_sql_comments" value="true"/&gt;
          &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/&gt;
          &lt;property name="hibernate.connection.url" value="jdbc:mysql://localhost/helloworldjpa"/&gt;
          &lt;property name="hibernate.connection.username" value="root"/&gt;
          &lt;property name="hibernate.connection.password" value="xxxx"/&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/&gt;
          &lt;property name="hbm2ddl.auto" value="update"/&gt;
          &lt;property name="hibernate.c3p0.min_size" value="5"/&gt;
          &lt;property name="hibernate.c3p0.max_size" value="20"/&gt;
          &lt;property name="hibernate.c3p0.timeout" value="300"/&gt;
          &lt;property name="hibernate.c3p0.max_statements" value="50"/&gt;
          &lt;property name="hibernate.c3p0.idle_test_period" value="3000"/&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>As "hbm2ddl.auto" property is update I expected the schema to get created.If I manually create the schema, it works fine.
  The log reads likle this:</p>
  
  <pre><code>Hibernate: 
  insert 
  into
      MESSAGES
      (MESSAGE_TEXT, NEXT_MESSAGE_ID) 
  values
      (?, ?)
  21:26:57,703  WARN JDBCExceptionReporter:71 - SQL Error: 1146, SQLState: 42S02
  21:26:57,718 ERROR JDBCExceptionReporter:72 - Table 'helloworldjpa.messages' doesn't exist
  Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not insert: [hello.Message]
      at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
      at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
      at hello.HelloWorld.main(HelloWorld.java:20)
  Caused by: org.hibernate.exception.SQLGrammarException: could not insert: [hello.Message]
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2093)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2573)
      at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
      at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
      at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
      at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
      at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
      at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
      at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
      at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
      ... 1 more
  Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'helloworldjpa.messages' doesn't exist
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
      at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
      ... 15 more
  </code></pre>