0

I'm using Hibernate to create mysql tables automatically within a maven JBoss project. When I deploy I get this info msg:

13:48:24,415 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-7) HHH000206: hibernate.properties not found

and this error:

13:50:44,880 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mydb.my_table' doesn't exist

I've included these properties in my persistence.xml:

 <?xml version="1.0" encoding="UTF-8"?>
<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">
 <persistence-unit name="primary">
  <!-- If you are running in a production environment, add a managed 
     data source, the example data source is just for development and testing! -->
        <jta-data-source>java:jboss/datasources/mydb</jta-data-source>
  <properties>
     <!-- Properties for Hibernate -->
 <property name="hibernate.hbm2ddl.auto" value="create" />   
 <property name="hibernate.show_sql" value="true" />
  </properties>
</persistence-unit>
</persistence>

and the appropriate dependencies in pom.xml:

hibernate-validator, hibernate-jpamodelgen, hibernate-validator-annotation-processor, hibernate-entitymanager and mysql-connector-java

but the tables are never created. What can I do?

Alice
  • 117
  • 5
  • 16

0 Answers0