/** Returns true if the specified attribute denotes a collection valued * relationship attribute. */ public boolean isCollectionValuedRelationship(Object ownerClass, String attribute) { DatabaseMapping mapping = resolveAttributeMapping(ownerClass, attribute); return (mapping != null) && (mapping.isOneToManyMapping() || mapping.isManyToManyMapping()); }
/** Returns true if the specified attribute denotes a single valued * or collection valued relationship attribute. */ public boolean isRelationship(Object ownerClass, String attribute) { DatabaseMapping mapping = resolveAttributeMapping(ownerClass, attribute); return (mapping != null) && (mapping.isObjectReferenceMapping() || mapping.isOneToManyMapping() || mapping.isManyToManyMapping()); }
/** * Build additional table/field definitions for the dscriptor, like relation table * and direct-collection, direct-map table, as well as reset LOB type for serialized * object mapping and type conversion maping for LOB usage */ private void postInitTableSchema(ClassDescriptor desc) { Iterator mappingIter = desc.getMappings().iterator(); while (mappingIter.hasNext()) { DatabaseMapping mapping = (DatabaseMapping) mappingIter.next(); if (mapping.isManyToManyMapping()) { buildRelationTableDefinition((ManyToManyMapping) mapping); } else if (mapping.isDirectCollectionMapping()) { buildDirectCollectionTableDefinition((DirectCollectionMapping) mapping, desc); } else if (mapping.isAggregateCollectionMapping()) { //need to figure out the target foreign key field and add it into the aggregate target table addForeignkeyFieldToAggregateTargetTable((AggregateCollectionMapping) mapping); } else if (mapping.isForeignReferenceMapping()) { if (mapping.isOneToOneMapping()) addForeignKeyFieldToSourceTargetTable((OneToOneMapping) mapping); else if (mapping.isOneToManyMapping()) addForeignKeyFieldToSourceTargetTable((OneToManyMapping) mapping); } } processAdditionalTablePkFields(desc); }
if (mapping.isOneToManyMapping()) { OneToManyMapping otm = (OneToManyMapping)mapping; foreignKeys = otm.getTargetForeignKeyToSourceKeys();
if (shouldUseOuterJoin && (!(mapping.isOneToOneMapping() || mapping.isOneToManyMapping() || mapping.isManyToManyMapping() || mapping.isAggregateCollectionMapping() || mapping.isDirectCollectionMapping()))) { throw QueryException.outerJoinIsOnlyValidForOneToOneMappings(getMapping());