Interface MappingRelationshipElement
- All Superinterfaces:
Comparable,MappingElement,MappingElementProperties,MappingFieldElement,MappingMemberElement
- All Known Implementing Classes:
MappingRelationshipElementImpl
This is a specialized field element which represents a relationship
between two classes. The mapping portion should be set up as follows:
When mapping a non-join table relationship, call the
MappingFieldElement.addColumn(org.netbeans.modules.dbschema.DBMemberElement)
method once with each pair of columns between the local table and the
foreign table. When mapping a join table relationship, call the
addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement) once for each pair of columns between the
local table and the join table and addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement) once for
each pair of columns between the join table and the foreign table.
Note that the number of pairs (local and associated) may differ and that
the order of adding them (local first or associated first) is not
important.- Version:
- %I%
- Author:
- Mark Munro, Rochelle Raccah
-
Field Summary
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElementProperties
PROP_ASSOCIATED_COLUMNS, PROP_COLUMNS, PROP_CONSISTENCY, PROP_DATABASE_ROOT, PROP_FETCH_GROUP, PROP_FIELDS, PROP_IN_CONCURRENCY_CHECK, PROP_KEY_COLUMNS, PROP_MODIFIED, PROP_NAME, PROP_NAVIGABLE, PROP_READ_ONLY, PROP_REFERENCING_KEYS, PROP_TABLE, PROP_TABLES, PROP_VERSION_FIELDFields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingFieldElement
GROUP_DEFAULT, GROUP_INDEPENDENT, GROUP_NONE -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement column) Adds a column to the list of associated columns mapped by this mapping field.voidaddLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement column) Adds a column to the list of columns mapped by this mapping field.Returns the list of associated column names to which this mapping field is mapped.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setNameMethods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingFieldElement
addColumn, getColumns, getFetchGroup, isInConcurrencyCheck, isReadOnly, isVersion, removeColumn, setFetchGroup, setInConcurrencyCheck, setReadOnly, setVersionMethods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
Method Details
-
getAssociatedColumns
ArrayList getAssociatedColumns()Returns the list of associated column names to which this mapping field is mapped. This is used for join tables.- Returns:
- the names of the columns mapped by this mapping field
- See Also:
-
addLocalColumn
Adds a column to the list of columns mapped by this mapping field. Call this method instead ofaddColumnwhen mapping join tables. This method is used to map between the local column and the join table, whileaddAssociatedColumnis used to map between the join table and the foreign table.- Parameters:
column- foreign column element to be added to the mapping- Throws:
ModelException- if impossible- See Also:
-
addAssociatedColumn
void addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement column) throws ModelException Adds a column to the list of associated columns mapped by this mapping field. Call this method instead ofaddColumnwhen mapping join tables. This method is used to map between the join table column and the foreign table column, whileaddLocalColumnis used to map between the local table and the join table.- Parameters:
column- foreign column element to be added to the mapping- Throws:
ModelException- if impossible- See Also:
-