throws HibernateException {
final Serializable id = key.getIdentifier();
// Get the persister for the _subclass_
final OgmEntityPersister persister = (OgmEntityPersister) getFactory().getEntityPersister( instanceEntityName );
if ( log.isTraceEnabled() ) {
log.trace(
"Initializing object from ResultSet: " +
MessageHelper.infoString( persister, id, getFactory() )
);
}
//FIXME figure out what that means and what value should be set
//boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);
boolean eagerPropertyFetch = true;
// add temp entry so that the next step is circular-reference
// safe - only needed because some types don't take proper
// advantage of two-phase-load (esp. components)
TwoPhaseLoad.addUninitializedEntity(
key,
object,
persister,
lockMode,
!eagerPropertyFetch,
session
);
//TODO what to do with that in OGM
// //This is not very nice (and quite slow):
// final String[][] cols = persister == rootPersister ?
// getEntityAliases()[i].getSuffixedPropertyAliases() :
// getEntityAliases()[i].getSuffixedPropertyAliases(persister);
final Object[] values = persister.hydrate(
resultset,
id,
object,
rootPersister,
//cols,
eagerPropertyFetch,
session
);
if ( persister.hasRowId() ) {
throw new HibernateException( "Hibernate OGM does nto support row id");
}
final Object rowId = null;
final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
if ( ukName != null ) {
final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex( ukName );
final Type type = persister.getPropertyTypes()[index];
// polymorphism not really handled completely correctly,
// perhaps...well, actually its ok, assuming that the
// entity name used in the lookup is the same as the
// the one used here, which it will be
EntityUniqueKey euk = new EntityUniqueKey(
rootPersister.getEntityName(), //polymorphism comment above
ukName,
type.semiResolve( values[index], session, object ),
type,
persister.getEntityMode(),
session.getFactory()
);
session.getPersistenceContext().addEntity( euk, object );
}
}