Author: steve.ebersole(a)jboss.com
Date: 2007-01-30 23:51:36 -0500 (Tue, 30 Jan 2007)
New Revision: 11118
Modified:
trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java
trunk/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java
Log:
HHH-2393 : generated properties resultset
Modified: trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java 2007-01-31 04:51:09 UTC
(rev 11117)
+++ trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java 2007-01-31 04:51:36 UTC
(rev 11118)
@@ -197,16 +197,16 @@
}
public void closeQueryStatement(PreparedStatement ps, ResultSet rs) throws SQLException
{
- statementsToClose.remove(ps);
- if (rs!=null) resultSetsToClose.remove(rs);
+ statementsToClose.remove( ps );
try {
- if (rs!=null) {
+ if ( rs != null ) {
+ resultSetsToClose.remove( rs );
logCloseResults();
rs.close();
}
}
finally {
- closeQueryStatement(ps);
+ closeQueryStatement( ps );
}
}
Modified:
trunk/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
---
trunk/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2007-01-31
04:51:09 UTC (rev 11117)
+++
trunk/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2007-01-31
04:51:36 UTC (rev 11118)
@@ -3692,30 +3692,26 @@
try {
PreparedStatement ps = session.getBatcher().prepareSelectStatement( selectionSQL );
+ ResultSet rs = null;
try {
getIdentifierType().nullSafeSet( ps, id, 1, session );
- ResultSet rs = session.getBatcher().getResultSet( ps );
- try {
- if ( !rs.next() ) {
- throw new HibernateException(
- "Unable to locate row for retrieval of generated properties: " +
- MessageHelper.infoString( this, id, getFactory() )
- );
+ rs = session.getBatcher().getResultSet( ps );
+ if ( !rs.next() ) {
+ throw new HibernateException(
+ "Unable to locate row for retrieval of generated properties: " +
+ MessageHelper.infoString( this, id, getFactory() )
+ );
+ }
+ for ( int i = 0; i < getPropertySpan(); i++ ) {
+ if ( includeds[i] != ValueInclusion.NONE ) {
+ Object hydratedState = getPropertyTypes()[i].hydrate( rs, getPropertyAliases(
"", i ), session, entity );
+ state[i] = getPropertyTypes()[i].resolve( hydratedState, session, entity );
+ setPropertyValue( entity, i, state[i], session.getEntityMode() );
}
- for ( int i = 0; i < getPropertySpan(); i++ ) {
- if ( includeds[i] != ValueInclusion.NONE ) {
- Object hydratedState = getPropertyTypes()[i].hydrate( rs, getPropertyAliases(
"", i ), session, entity );
- state[i] = getPropertyTypes()[i].resolve( hydratedState, session, entity );
- setPropertyValue( entity, i, state[i], session.getEntityMode() );
- }
- }
}
- finally {
- rs.close();
- }
}
finally {
- session.getBatcher().closeStatement(ps);
+ session.getBatcher().closeQueryStatement( ps, rs );
}
}
catch( SQLException sqle ) {
Show replies by date