Methods Summary |
---|
public java.util.List | getCascadeTypes()INTERNAL: (Overridden in XMLOneToManyAccessor)
if (m_oneToMany == null) {
return new ArrayList<String>();
} else {
return getCascadeTypes(m_oneToMany.cascade());
}
|
public java.lang.String | getFetchType()INTERNAL: (Overridden in XMLOneToManyAccessor)
return (m_oneToMany == null) ? MetadataConstants.LAZY : m_oneToMany.fetch().name();
|
protected java.lang.String | getLoggingContext()INTERNAL:
Return the logging context for this accessor.
return m_logger.ONE_TO_MANY_MAPPING_REFERENCE_CLASS;
|
public java.lang.String | getMappedBy()INTERNAL: (Overridden in XMLOneToManyAccessor)
return (m_oneToMany == null) ? "" : m_oneToMany.mappedBy();
|
public java.lang.Class | getTargetEntity()INTERNAL: (Overridden in XMLOneToManyAccessor)
return (m_oneToMany == null) ? void.class : m_oneToMany.targetEntity();
|
public boolean | isOneToMany()INTERNAL:
return true;
|
public void | process()INTERNAL:
Process an @OneToMany or one-to-many element into a TopLink OneToMany
mapping. If a JoinTable is found however, we must create a ManyToMany
mapping.
String mappedBy = getMappedBy();
// Should be treated as a uni-directional mapping using a join table.
if (mappedBy.equals("")) {
// If we find a JoinColumn(s), then throw an exception.
if (hasJoinColumn() || hasJoinColumns()) {
getValidator().throwUniDirectionalOneToManyHasJoinColumnSpecified(getAttributeName(), getJavaClass());
}
// Create a M-M mapping and process common collection mapping
// metadata.
ManyToManyMapping mapping = new ManyToManyMapping();
process(mapping);
// Process the @JoinTable.
processJoinTable(getJoinTable(), mapping);
// Add the mapping to the descriptor.
m_descriptor.addMapping(mapping);
} else {
// Create a 1-M mapping and process common collection mapping
// metadata.
OneToManyMapping mapping = new OneToManyMapping();
process(mapping);
// Non-owning side, process the foreign keys from the owner.
OneToOneMapping ownerMapping = null;
if (getOwningMapping().isOneToOneMapping()){
ownerMapping = (OneToOneMapping) getOwningMapping();
} else {
// If improper mapping encountered, throw an exception.
getValidator().throwInvalidMappingEncountered(getJavaClass(), getReferenceClass());
}
Map<DatabaseField, DatabaseField> keys = ownerMapping.getSourceToTargetKeyFields();
for (DatabaseField fkField : keys.keySet()) {
mapping.addTargetForeignKeyField(fkField, keys.get(fkField));
}
// Add the mapping to the descriptor.
m_descriptor.addMapping(mapping);
}
|