HHH-1312 : Unclosed ResultSet when using Identity

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14099 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2007-10-18 06:20:04 +00:00
parent 0a6a160709
commit b0beac4acd
1 changed files with 13 additions and 4 deletions

View File

@ -70,11 +70,20 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
public Serializable executeAndExtract(PreparedStatement insert) throws SQLException {
insert.executeUpdate();
ResultSet rs = null;
try {
rs = insert.getGeneratedKeys();
return IdentifierGeneratorFactory.getGeneratedIdentity(
insert.getGeneratedKeys(),
rs,
persister.getIdentifierType()
);
}
finally {
if ( rs != null ) {
rs.close();
}
}
}
}
/**