I run a Grails app successfully on Windows localhost. Then I deploy the war onto Linux. The whole app works correctly except Hibernate (I believe) has no wish for creating any table there:
org.springframework.dao.InvalidDataAccessResourceUsageException:
could not execute query;
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Table 'xxx.yyy' doesn't exist
...
(no other errors noticed)
Once I manually create all tables, the app works fine.
The question is how to make the tables auto created? Just as it should be.
Local MySQL:
MySQL Ver 14.14 Distrib 5.5.28, for Win64 (x86)
The server’s MySQL:
mysql Ver 14.14 Distrib 5.5.24, for debian-linux-gnu (x86_64) using readline 6.2
File /etc/tomcat7/context.xml:
<Resource name="jdbc/XXX" auth="Container"
type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/xxx"
username="xxx" password="xxx" maxActive="20" maxIdle="10"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
maxWait="-1"/>
Set the hibernate property hbm2ddl.auto to ‘create’ in you’re hibernate configuration file.