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:
parent
0a6a160709
commit
b0beac4acd
|
@ -70,10 +70,19 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
|
|||
|
||||
public Serializable executeAndExtract(PreparedStatement insert) throws SQLException {
|
||||
insert.executeUpdate();
|
||||
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
||||
insert.getGeneratedKeys(),
|
||||
persister.getIdentifierType()
|
||||
);
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
rs = insert.getGeneratedKeys();
|
||||
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
||||
rs,
|
||||
persister.getIdentifierType()
|
||||
);
|
||||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
rs.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue