HHH-1312 : Unclosed ResultSet when using Identity
git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@14098 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
45e29dd47c
commit
0b38fa21ce
|
@ -71,10 +71,19 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
|
|||
|
||||
public Serializable executeAndExtract(PreparedStatement insert) throws SQLException {
|
||||
insert.executeUpdate();
|
||||
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
||||
GetGeneratedKeysHelper.getGeneratedKey( insert ),
|
||||
persister.getIdentifierType()
|
||||
);
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
rs = GetGeneratedKeysHelper.getGeneratedKey( insert );
|
||||
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
||||
rs,
|
||||
persister.getIdentifierType()
|
||||
);
|
||||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
rs.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue