Object ownerPKey = owner.getObjectId();
if (ownerPKey instanceof TransientKey) {
return null;
}
Column columnToUse = null;
if (mapping.getSource().getColumn() != null) {
columnToUse = mapping.getSource().getColumn();
}
else if (mapping.getFilter() != null) {
// In this case, source wasn't specified, but target
// is always specified...and in this case should be
// the primary key column of the owner class (see
// ModelMapping.parseRelationship).
columnToUse = mapping.getTarget().getColumn();
}
else {
// How did we get here? An exception should have been
// thrown in ModelMapping.parseRelationship
throw new JDOFatalUserException(I18N.msg("E_collection_no_source"));
}
Selector selector = new Selector
(columnToUse.getTable(),
new SimpleCondition(columnToUse, Operator.EQUAL, ownerPKey));
if (mapping.getFilter() != null) {
logger.fine("Filter: " + mapping.getFilter());
logger.fine("Imports: " + mapping.getImports());