Quantcast
Channel: Java Programming Forum - Learn Java Programming - Hibernate
Viewing all articles
Browse latest Browse all 76

Hibernate not creating tables

$
0
0
Hello,

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.MySQLSyntaxErrorEx ception: 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="
Java Persistence API: XML Schemas
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

the datastore is successfully bounded, but the tables are never created . What can I do?:(sweat):


One more info: I've deleted my *-ds.xml file under Deployed Resources/webapp/WEB-INF because it was causing two errors: Duplicate resources & Failed to process phase INSTALL of deployment *.war

I appreciate your help! :(happy):

Viewing all articles
Browse latest Browse all 76

Trending Articles