Previously, my Java web projects used Eclipse-ordinary structure, and at the start of the container (in case, Tomcat), Hibernate generated the schemes correctly.
Now I’m using Maven infrastructure. I’ve relocated the needed files and configured all well (I think, because all is working right: Spring is starting, Hibernate is connecting the database – when it was previously created and there’s some data to fetch). I’ve tested all CRUD operations and it’s working.
The problem is that Hibernate refuses to generate the schemes (DDL) as it did when over Eclipse-ordinary infrastructure.
Additional information:
-
My persistence.xml is almost empty (as always) because Spring applicationContext.xml is starting it. I have not changed the file, it continues the same way as before.
<!-- Location: src/main/resources/META-INF/persistence.xml --> <persistence> <persistence-unit name="jpa-persistence-unit" transaction-type="RESOURCE_LOCAL"/> </persistence> -
Part of the Spring configuration goes here (applicationContext.xml):
<!-- Location: src/main/webapp/WEB-INF/applicationContext.xml --> <!-- ... --> <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="database" value="[DATABASE-NAME]" /> <property name="showSql" value="true" /> <property name="generateDdl" value="true" /> <!-- THIS CONFIGURATION WORKED PREVIOUSLY, NOW WITH MAVEN, IT'S IGNORED --> <property name="databasePlatform" value="[DIALECT]" /> </bean> <!-- ... --> -
I’m not using any Maven Hibernate plugin, because I just want the default behavior that occurred earlier.
- Did Maven invalidate this “generateDdl” property!? Why!? What should I do!? I can’t find any solution.
I found out the solution.
Maven has any fault about that.
Hibernate was not able to create my database because the “DIALECT” was wrong.
I remembered that I changed the dialect from MySQL to MySQL-InnoDB. Hibernate was logging this problem but I couldn’t see it because the slf4j-simple dependency was not explicity imported.
Thank you for your time, Shawn.