-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate case sensitive mapping with Grails
PostPosted: Fri Oct 22, 2010 11:51 am 
Newbie

Joined: Fri Oct 22, 2010 11:36 am
Posts: 1
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


Top
 Profile  
 
 Post subject: Re: Hibernate case sensitive mapping with Grails
PostPosted: Tue Oct 26, 2010 12:03 pm 
Senior
Senior

Joined: Fri Oct 08, 2010 8:44 am
Posts: 130
Does Grails allow custom object-relational mappings using annotations, XML or something else?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.