Today I tried to deploy my application from my OSX dev machine to a server on Amazon EC2.
I was running into exceptions like this:
Caused by: org.hibernate.exception.SQLGrammarException: could not load an entity: [app.model.entities.Jobs#8]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1895)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:207)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:822)
at org.hibernate.impl.SessionImpl.load(SessionImpl.java:815)
at org.springframework.orm.hibernate3.HibernateTemplate$3.doInHibernate(HibernateTemplate.java:569)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
… 30 more
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table ‘database.Files’ doesn’t exist
Although all my table names are lowercase it seems that Hibernate tries to create case-sensitive SQL queries which relate to the name of my POJOs (e.g. MyPojo) .
While this was working on my OSX it didn’t on Fedora Linux on EC2.
Solution:
In my /etc/my.cnf I had to add the following configuration property:
Resolving Hibernate exceptions with MySQL on Linux because of case-sensitive table names
Today I tried to deploy my application from my OSX dev machine to a server on Amazon EC2.
I was running into exceptions like this:
Although all my table names are lowercase it seems that Hibernate tries to create case-sensitive SQL queries which relate to the name of my POJOs (e.g. MyPojo) .
While this was working on my OSX it didn’t on Fedora Linux on EC2.
Solution:
In my /etc/my.cnf I had to add the following configuration property:
Thanks to the following articles which helped me:
http://www.parkroad.co.za/mysql-case-sensitivity-table-names-between-windows-and-linux-systems
http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html
https://forum.hibernate.org/viewtopic.php?p=2394017