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:

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:

lower_case_table_names=1

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

Dieser Beitrag wurde unter Software-Development abgelegt und mit , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

2 Antworten auf Resolving Hibernate exceptions with MySQL on Linux because of case-sensitive table names

  1. Pingback: jeux casino

  2. Just want to say your article is as astounding. The clarity in your post is simply excellent and i can assume you are an expert on this subject. Fine with your permission let me to grab your RSS feed to keep updated with forthcoming post. Thanks a million and please keep up the gratifying work.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

CAPTCHA-Bild

*