// use an outer join for to-many matches
resolveJoin(false);
// TODO: andrus, 6/21/2007 - flattened support
DbRelationship dbRelationship = relationship.getDbRelationships().get(0);
DbEntity table = (DbEntity) dbRelationship.getTargetEntity();
String alias = this.lastAlias != null ? lastAlias : context.getTableAlias(
idPath,
table.getFullyQualifiedName());
Collection<DbAttribute> pks = table.getPrimaryKeys();
if (pks.size() == 1) {
DbAttribute pk = pks.iterator().next();
context.append(' ');
if (isUsingAliases()) {
context.append(alias).append('.');
}
context.append(pk.getName());
}
else {
throw new EJBQLException(
"Multi-column PK to-many matches are not yet supported.");
}
}
else {
// match FK against the target object
// TODO: andrus, 6/21/2007 - flattened support
DbRelationship dbRelationship = relationship.getDbRelationships().get(0);
DbEntity table = (DbEntity) dbRelationship.getSourceEntity();
String alias = this.lastAlias != null ? lastAlias : context.getTableAlias(
idPath,
table.getFullyQualifiedName());
List<DbJoin> joins = dbRelationship.getJoins();
if (joins.size() == 1) {
DbJoin join = joins.get(0);
context.append(' ');
if (isUsingAliases()) {