FieldManager fm = new QueryEntityPKFetchFieldManager(acmd, entity);
id = IdentityUtils.getApplicationIdentityForResultSetRow(ec, acmd, cls, true, fm);
}
Object pojo = ec.findObject(id, fv, cls, ignoreCache, false);
ObjectProvider op = ec.findObjectProvider(pojo);
// TODO(maxr): Seems like we should be able to refactor the handler
// so that we can do a fetch without having to hide the entity in the state manager.
op.setAssociatedValue(((DatastoreManager)ec.getStoreManager()).getDatastoreTransaction(ec), entity);
// Make sure any version is set
if (acmd.isVersioned()) {
VersionMetaData vermd = acmd.getVersionMetaDataForClass();
Object versionValue = entity.getProperty(EntityUtils.getVersionPropertyName(storeMgr.getIdentifierFactory(), vermd));
if (vermd.getVersionStrategy() == VersionStrategy.DATE_TIME) {
versionValue = new Timestamp((Long)versionValue);
}
op.setVersion(versionValue);
}
if (fetchPlan == null) {
// Projection, so load everything
// TODO Remove this. It prevents postLoad calls being made, but do we care since its a projection?