Interface MappingReferenceKeyElement
-
- All Superinterfaces:
org.netbeans.modules.dbschema.ColumnPairElementHolder,Comparable,MappingElement,MappingElementProperties,MappingMemberElement,org.netbeans.modules.dbschema.ReferenceKey
- All Known Implementing Classes:
MappingReferenceKeyElementImpl
public interface MappingReferenceKeyElement extends MappingMemberElement, org.netbeans.modules.dbschema.ReferenceKey
This is an element which represents a relationship between two tables (primary and secondary). It should not be used for relationship fields (MappingRelationshipElement has its own set of pairs). It can be thought of as a "fake foreign key" meaning it designates the column pairs used to join the primary table with a secondary table. It is analagous to a foreign key and may in fact contain identical pairs as the foreign key, but this is not a requirement. The foreign key may define a different set of pairs or may not exist at all. Although any set of pairs is legal, the user should be careful to define pairs which represent a logical relationship between the two tables. The relationship should be set up as follows: First, set a primary table for the mapping class. Doing this sets up a "fake primary key" for the associated mapping table element. Next, add a secondary table and set up the pairs which establish the connection on the returned reference key object. This sets up whatever "fake primary key" information is necessary on the secondary table's mapping table, establishes the primary to secondary relationship via the reference keys, and puts the pair information into the "fake foreign key".- 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_FIELD
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)Add a new column pair to the holder.voidaddColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Add some new column pairs to the holder.ArrayListgetColumnPairNames()Returns the list of relative column pair names in this referencing key.MappingTableElementgetTable()Returns the mapping table element for this referencing key.voidremoveColumnPair(String pairName)Remove a column pair from the holder.voidremoveColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)Remove a column pair from the holder.voidremoveColumnPairs(ArrayList pairNames)Remove some column pairs from the holder.voidremoveColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Remove some column pairs from the holder.voidsetColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)Set the column pairs for this holder.voidsetTable(MappingTableElement table)Set the mapping table for this referencing key to the supplied table.-
Methods inherited from interface org.netbeans.modules.dbschema.ColumnPairElementHolder
getColumnPair, getColumnPairs
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
-
-
-
Method Detail
-
getTable
MappingTableElement getTable()
Returns the mapping table element for this referencing key.- Returns:
- the meta data table for this referencing key
-
setTable
void setTable(MappingTableElement table) throws ModelException
Set the mapping table for this referencing key to the supplied table.- Parameters:
table- mapping table element to be used with this key.- Throws:
ModelException- if impossible
-
getColumnPairNames
ArrayList getColumnPairNames()
Returns the list of relative column pair names in this referencing key.- Returns:
- the names of the column pairs in this referencing key
-
removeColumnPair
void removeColumnPair(String pairName) throws ModelException
Remove a column pair from the holder. This method can be used to remove a pair by name when it cannot be resolved to an actual pair.- Parameters:
pairName- the relative name of the column pair to remove- Throws:
ModelException- if impossible
-
removeColumnPairs
void removeColumnPairs(ArrayList pairNames) throws ModelException
Remove some column pairs from the holder. This method can be used to remove pairs by name when they cannot be resolved to actual pairs.- Parameters:
pairNames- the relative names of the column pairs to remove- Throws:
ModelException- if impossible
-
addColumnPair
void addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelExceptionAdd a new column pair to the holder.- Specified by:
addColumnPairin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
pair- the pair to add- Throws:
ModelException- if impossible
-
addColumnPairs
void addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionAdd some new column pairs to the holder.- Specified by:
addColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
pairs- the column pairs to add- Throws:
ModelException- if impossible
-
removeColumnPair
void removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelExceptionRemove a column pair from the holder.- Specified by:
removeColumnPairin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
pair- the column pair to remove- Throws:
ModelException- if impossible
-
removeColumnPairs
void removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionRemove some column pairs from the holder.- Specified by:
removeColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
pairs- the column pairs to remove- Throws:
ModelException- if impossible
-
setColumnPairs
void setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelExceptionSet the column pairs for this holder. Previous column pairs are removed.- Specified by:
setColumnPairsin interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder- Parameters:
pairs- the new column pairs- Throws:
ModelException- if impossible
-
-