Hello,
I'm a new developer in Grails. I'm thus using hibernate to store my data in the database. My problem is that I want to use a PostGres SQL legacy database and I need to keep my model with the correct case.
I have the following Grails configuration :
dataSource { pooled = true driverClassName = "org.postgresql.Driver" dialect = org.hibernate.dialect.PostgreSQLDialect //dialect = net.sf.hibernate.dialect.PostgreSQLDialect } hibernate { cache.use_second_level_cache=false cache.use_query_cache=false cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' } // environment specific settings environments { development { dataSource { // one of 'create', 'create-drop','update' //dbCreate = "create-drop" // Disabled because I want to use my legacy database url="jdbc:postgresql://localhost:5432/<name of my database>" username = "postgres" password = "passwd" } } }
And then of course when I try to create a new object from the administration interface I got the following error:
org.postgresql.util.PSQLException: ERROR: relation "menu" does not exist Position : 58 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93) at bbrwebapp.MenuController$_closure2.doCall(script1287761537567442916963.groovy:13) at bbrwebapp.MenuController$_closure2.doCall(script1287761537567442916963.groovy) at java.lang.Thread.run(Thread.java:613)
Because as you can imagine, Hibernate try to use the table "menu" instead of "Menu" but my class name is well "Menu".
I tried to set the table name at "menu" in PostGres SQL and it works fine unfortunately, I absolutely need to keep the case sensitive inside my application.
Does anyone know a way for doing this job by configuring Hibernate for example or by modifying something in the source of hibernate?
I'm screwed on that since days, I really need help, I tried everything I was able to find on the web. Many thanks in advance for any help.
BĂ©renger
|