Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.0-RC-1
-
None
-
Linux, Fedora Core 3, Java 1.5, JTDS 1.2, SQL Server 2000
Description
The current Sql.executeInsert (String, LIst) which all code goes through uses this way of executing a prepared statement:
statement = connection.prepareStatement(sql);
setParameters(params, statement);
configure(statement);
boolean hasResultSet = statement.execute(sql, Statement.RETURN_GENERATED_KEYS);
The JTDS driver complains about this - you're not meant to call execute passing in some SQL when it's already been prepared.
The following code works instead:
statement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
setParameters(params, statement);
configure(statement);
this.updateCount = statement.executeUpdate();
Apologies for this not being provided as a patch - I haven't looked yet to see where else it might be occurring, and I also haven't worked out the best way of unit testing it (beyond mocks). I wanted to raise it in time for someone more experienced to look before v1 goes out though!