Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader
In directory usw-pr-cvs1:/tmp/cvs-serv24773/hibernate/loader
Modified Files:
Loader.java
Log Message:
fixed a bug with embedded composite-ids and outerjoin fetching
Index: Loader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader/Loader.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** Loader.java 4 Nov 2002 08:10:49 -0000 1.24
--- Loader.java 7 Nov 2002 10:10:59 -0000 1.25
***************
*** 240,246 ****
if ( optionalObjectKey!=null && key.equals(optionalObjectKey) ) {
- //if ( instanceClass != optionalObject.getClass() )
- //throw new WrongClassException( "given object of was wrong subclass", key.getIdentifier(), instanceClass );
-
//its the given optional object
object=optionalObject;
--- 240,243 ----
***************
*** 249,256 ****
}
else {
// instantiate a new instance
! object = session.getFactory().getPersister(instanceClass).instantiate(
! (optionalID==null) ? key.getIdentifier() : optionalID
! );
}
--- 246,256 ----
}
else {
+ Serializable idInstance = key.getIdentifier();
+ //Warning: the following code forces optionalID to refer to the last column of results!!!!
+ if ( i==cols-1 && optionalID!=null && optionalID.equals(idInstance) ) {
+ idInstance = optionalID;
+ }
// instantiate a new instance
! object = session.getFactory().getPersister(instanceClass).instantiate(idInstance);
}
|