}
public Object getPrimaryKeyValue(Result res, Column[] cols, ForeignKey fk,
JDBCStore store, Joins joins)
throws SQLException {
ClassMapping relmapping = field.getTypeMapping();
if (relmapping.getIdentityType() == ClassMapping.ID_DATASTORE) {
Column col = cols[0];
if (fk != null)
col = fk.getColumn(col);
long id = res.getLong(col, joins);
if (field.getObjectIdFieldTypeCode() == JavaTypes.LONG)
return Numbers.valueOf(id);
return store.newDataStoreId(id, relmapping, field.getPolymorphic()
!= ValueMapping.POLY_FALSE);
}
if (relmapping.isOpenJPAIdentity())
return ((Joinable) relmapping.getPrimaryKeyFieldMappings()[0].
getStrategy()).getPrimaryKeyValue(res, cols, fk, store, joins);
if (cols == getColumns() && fk == null)
fk = field.getForeignKey();
else
fk = createTranslatingForeignKey(relmapping, cols, fk);
return relmapping.getObjectId(store, res, fk,
field.getPolymorphic() != ValueMapping.POLY_FALSE, joins);
}