-->
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 chokes on Postgres case sensitiviness
PostPosted: Thu Sep 27, 2007 9:46 am 
Newbie

Joined: Thu Sep 27, 2007 9:35 am
Posts: 2
Hibernate version: 3
DB: Postgres 8.1

I have some mappings to columns like notMCPS that are causing these kind of errors:

Code:
Caused by: org.postgresql.util.PSQLException: ERROR: column label0_1_.notmcps does not exist


My column definition includes the correct name:

Quote:
@Column(name = "notMCPS", unique = false, nullable = true, insertable = true, updatable = true)


They ocurr because hibernate's generated sql is lowercasing all column names.

The problem is similar in a psql client, your column names are lowercased automatically, unless you put them in quotes. If I run the same query as hibernate (lowercase names) it fails, if i do select "notMCPS" from blah it works perfectly.

So I guess my question is, how can I force hibernate to respect the case on field names? Or is there any other workaround for this? Unfortunately renaming columns is not an option.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 28, 2007 8:36 am 
Newbie

Joined: Thu Sep 27, 2007 9:35 am
Posts: 2
Ok I found the solution in case anyone finds it useful.. as simple as:

Code:
@Column(name = "\"notMCPS\"", unique = false, nullable = true, insertable = true, updatable = true)


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.