]
Steve Ebersole closed HHH-1479.
-------------------------------
Resolution: Cannot Reproduce
guys, as mentioned quite a while ago, 3.2 reverted back to using that version of
prepareStatement for generated keys.
Incompatibility of Hibernate 3.1 and JTOpen JDBC drivers for IBM
AS/400
-----------------------------------------------------------------------
Key: HHH-1479
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1479
Project: Hibernate3
Issue Type: Patch
Affects Versions: 3.1
Environment: Hibernate 3.1
JDBC driver: JTOpen (for IBM AS/400)
http://jt400.sourceforge.net
Reporter: Davide Rogora
Assignee: Steve Ebersole
Hello,
I've noticed that from version 3.1 Hibernate, when calling JDBC driver for INSERT
statement, uses the following prepareStatement method:
prepareStatement(String sql, String[] columnNames)
instead of the following
prepareStatement(String sql, int autoGeneratedKeys)
used since versione 3.0.x
the problem is that JDBC driver for AS/400 (project JTOpen on sourceforge:
http://jt400.sourceforge.net) doesn't support the method prepareStatement(String sql,
String[] columnNames) so it's not possible to use Hibernate 3.1 with AS/400
I've also noticed that other open source drivers that support this method (for
example MySQL Jdbcconnector or JTDS for Ms-SQLServer) have implemented it using a
workaround; infact they call the "old" prepareStatement(String sql, int
autoGeneratedKeys) method ignoring the content of the columnNames array.
Here is the source of the jtds implementation:
-------------------------------------------------------------------------------
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException {
if (columnNames == null) {
throw new SQLException(
Messages.get("error.generic.nullparam",
"prepareStatement"),"HY092");
} else if (columnNames.length != 1) {
throw new SQLException(
Messages.get("error.generic.needcolname",
"prepareStatement"),"HY092");
}
return prepareStatement(sql, JtdsStatement.RETURN_GENERATED_KEYS);
}
-------------------------------------------------------------------------------
So I'm asking to the Hibernate team if it's possible to use the old method
prepareStatement(String sql, int autoGeneratedKeys) in the future releases of Hibernate.
Thanks,
Davide Rogora.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: