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 {
|
public Serializable executeAndExtract(PreparedStatement insert) throws SQLException {
|
||||||
insert.executeUpdate();
|
insert.executeUpdate();
|
||||||
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
ResultSet rs = null;
|
||||||
insert.getGeneratedKeys(),
|
try {
|
||||||
persister.getIdentifierType()
|
rs = insert.getGeneratedKeys();
|
||||||
);
|
return IdentifierGeneratorFactory.getGeneratedIdentity(
|
||||||
|
rs,
|
||||||
|
persister.getIdentifierType()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if ( rs != null ) {
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue