[hibernate-issues] [Hibernate-JIRA] Created: (HHH-1994) Problem with case sensitive column and tables names and Identity mapping with postgreSQL
Alex Samad (JIRA)
noreply at atlassian.com
Fri Aug 11 00:08:19 EDT 2006
Problem with case sensitive column and tables names and Identity mapping with postgreSQL
----------------------------------------------------------------------------------------
Key: HHH-1994
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1994
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: Hibernate 3.1.3, Java 1.5.0_07 (sun) windos and linux ( 32 & 64 bit). POstgres SQL 8.1 Windows and linux
Reporter: Alex Samad
Whilst trying to insert into a table with a primary key (ID mapping) which has a identity generator. And the columns and/or the table has been defined with case sensitivey ie back ticks.
It fails to get the next serial number and thus fails any inserts.
The problem lies in dialect/PostgreSQLDialect.java
public String getIdentitySelectString(String table, String column, int type) {
return new StringBuffer().append("select currval('")
.append(table)
.append('_')
.append(column)
.append("_seq')")
.toString();
}
table is inclosed in quotes and column is inclosed in quotes which gives a name like
"table"_"Column"_seq - which fails
I would suggest a fix is to test each of table or column for " and if it exist then to strip it of both of table and column and encluse the whole name in "". This mighe break some old code where say the table is coded in case insensitive table name and case sensitive column key.
Sorry not much of a java programmer.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list