[Hibernate-JIRA] Created: (HHH-1994) Problem with case sensitive column and tables names and Identity mapping with postgreSQL
by Alex Samad (JIRA)
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
13 years, 7 months
[Hibernate-JIRA] Created: (HHH-5790) method BasicBinder#bind() slow because formatting for trace is done also with disabled trace
by Guenther Demetz (JIRA)
method BasicBinder#bind() slow because formatting for trace is done also with disabled trace
--------------------------------------------------------------------------------------------
Key: HHH-5790
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5790
Project: Hibernate Core
Issue Type: Improvement
Affects Versions: 3.6.0
Environment: 3_6_0_final
Reporter: Guenther Demetz
In the ELSE block of method org.hibernate.type.descriptor.sql.BasicBinder#bind
the if statement "if (log.isTraceEnabled())" is missing, so strings are formatted
even if trace logging is disabled.
CURRENT CODE:
if ( value == null ) {
if ( log.isTraceEnabled() ) {
log.trace(String.format(...);
}
st.setNull( index, sqlDescriptor.getSqlType() );
}
else {
log.trace(String.format(BIND_MSG_TEMPLATE,index, ...);
doBind( st, value, index, options );
}
IMPROVEMENT:
if ( value == null ) {
if ( log.isTraceEnabled() ) {
log.trace(String.format(...);
}
st.setNull( index, sqlDescriptor.getSqlType() );
}
else {
if ( log.isTraceEnabled() ) { //// NEW LINE
log.trace(String.format(BIND_MSG_TEMPLATE,index, ...);
} //// NEW LINE
doBind( st, value, index, options );
}
BTW: By doing this little code enhancement, I was able to achieve almost the double speed when inserting data.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months