com.sun.jdo.api.persistence.model.mapping
Interface MappingRelationshipElement

All Superinterfaces:
Comparable, MappingElement, MappingElementProperties, MappingFieldElement, MappingMemberElement
All Known Implementing Classes:
MappingRelationshipElementImpl

public interface MappingRelationshipElement
extends MappingFieldElement

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.MappingFieldElement
GROUP_DEFAULT, GROUP_INDEPENDENT, GROUP_NONE
 
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_FIELD
 
Method Summary
 void addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
          Adds a column to the list of associated columns mapped by this mapping field.
 void addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
          Adds a column to the list of columns mapped by this mapping field.
 ArrayList getAssociatedColumns()
          Returns the list of associated column names to which this mapping field is mapped.
 
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingFieldElement
addColumn, getColumns, getFetchGroup, isInConcurrencyCheck, isReadOnly, isVersion, removeColumn, setFetchGroup, setInConcurrencyCheck, setReadOnly, setVersion
 
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
 
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

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:
MappingFieldElement.getColumns()

addLocalColumn

void addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement column)
                    throws ModelException
Adds a column to the list of columns mapped by this mapping field. Call this method instead of addColumn when mapping join tables. This method is used to map between the local column and the join table, while addAssociatedColumn is 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:
MappingFieldElement.addColumn(org.netbeans.modules.dbschema.DBMemberElement), addAssociatedColumn(org.netbeans.modules.dbschema.ColumnPairElement)

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 of addColumn when mapping join tables. This method is used to map between the join table column and the foreign table column, while addLocalColumn is 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:
MappingFieldElement.addColumn(org.netbeans.modules.dbschema.DBMemberElement), addLocalColumn(org.netbeans.modules.dbschema.ColumnPairElement)


Copyright © 2012 GlassFish Community. All Rights Reserved.