title: MySQL - Hibernate does not create foreign key constraint
body: <p>I am, moving my application from Derby to MySQL, and facing the problem that hibernate doesn't create the foreign key constraints while initially creating the tables. All me mappings seems to be correct as they were working fine with Derby. </p>
  
  <p>I am using MySQL Server 5.6, and also MySQL5InnoDBDialect. Also i verified in the MySQL workbench using show create table command that the table are being created using innoDB engine.</p>
  
  <p>MySQL connector used - mysql-connector-java - 5.1.6</p>
  
  <p>Logs:</p>
  
  <pre><code>2014-04-21 12:38:29,820 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: alter table DEPENDENCY_TRACK add constraint FK25E3373737E62D9A foreign key (TOOL_ID) references TOOL_MASTER
  2014-04-21 12:38:29,820 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Cannot add foreign key constraint
  2014-04-21 12:38:30,127 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: alter table DEPT_ROLE add constraint FK7E895E3080D96D8 foreign key (DEPARTMENT_ID) references DEPARTMENT
  2014-04-21 12:38:30,128 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Cannot add foreign key constraint
  </code></pre>
  
  <p>Persistance.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"&gt;
      &lt;persistence-unit name="hibernatePersistenceUnit" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;properties&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; 
              &lt;!-- &lt;property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" /&gt; --&gt;
              &lt;!-- &lt;property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /&gt; --&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
              &lt;property name="hibernate.show_sql" value="true"/&gt;
              &lt;property key="hibernate.hbm2ddl.import_files"&gt;import.sql&lt;/property&gt;
          &lt;/properties&gt;
          &lt;mapping-file&gt;META-INF/orm.xml&lt;/mapping-file&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>database.properties</p>
  
  <pre><code># database properties
  app.jdbc.driverClassName    =   com.mysql.jdbc.Driver
  app.jdbc.url                =   jdbc:mysql://localhost:3306/alt
  app.jdbc.username           =   root
  app.jdbc.password           =   root
  </code></pre>