org.datanucleus.metadata
Class JoinMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.JoinMetaData
All Implemented Interfaces:
java.io.Serializable, ColumnMetaDataContainer

public class JoinMetaData
extends MetaData
implements ColumnMetaDataContainer

Secondary tables and join tables are mapped using a join condition that associates a column or columns in the secondary or join table with a column or columns in the primary table, typically the primary tables primary key columns. Column elements used for relationship mapping or join conditions specify the column name and optionally the target column name. The target column name is the name of the column in the associated table corresponding to the named column. The target column name is optional when the target column is the single primary key column of the associated table.

See Also:
Serialized Form

Field Summary
protected  ColumnMetaData[] columnMetaData
          Contains the metadata for column
protected  IndexedValue indexed
          The indexing value
protected  PrimaryKeyMetaData primaryKeyMetaData
          PrimaryKey MetaData
protected  boolean unique
          Whether to add a unique constraint.
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
JoinMetaData()
          Default constructor.
JoinMetaData(JoinMetaData joinmd)
          Constructor to create a copy of the passed JoinMetaData.
 
Method Summary
 void addColumn(ColumnMetaData colmd)
          Add a new ColumnMetaData element
 java.lang.String getCatalog()
           
 ColumnMetaData[] getColumnMetaData()
          Accessor for columnMetaData
 java.lang.String getColumnName()
           
 java.lang.String getDeleteAction()
           
 ForeignKeyMetaData getForeignKeyMetaData()
           
 IndexedValue getIndexed()
           
 IndexMetaData getIndexMetaData()
           
 PrimaryKeyMetaData getPrimaryKeyMetaData()
          Accessor for primaryKeyMetaData
 java.lang.String getSchema()
           
 java.lang.String getTable()
           
 UniqueMetaData getUniqueMetaData()
           
 void initialise(ClassLoaderResolver clr, MetaDataManager mmgr)
          Method to initialise the object, creating internal convenience arrays.
 boolean isOuter()
           
 boolean isUnique()
           
 ColumnMetaData newColumnMetaData()
          Method to create a new column metadata, add it, and return it.
 ForeignKeyMetaData newForeignKeyMetaData()
          Method to create a new FK metadata, set to use it, and return it.
 IndexMetaData newIndexMetaData()
          Method to create a new index metadata, set to use it, and return it.
 PrimaryKeyMetaData newPrimaryKeyMetaData()
          Method to create a new PK metadata, set to use it, and return it.
 UniqueMetaData newUniqueMetaData()
          Method to create a new unique metadata, set to use it, and return it.
 JoinMetaData setCatalog(java.lang.String catalog)
           
 JoinMetaData setColumnName(java.lang.String columnName)
           
 JoinMetaData setDeleteAction(java.lang.String deleteAction)
           
 void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
           
 JoinMetaData setIndexed(IndexedValue indexed)
           
 void setIndexMetaData(IndexMetaData indexMetaData)
           
 JoinMetaData setOuter(boolean outer)
           
 JoinMetaData setOuter(java.lang.String outer)
           
 void setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
          Mutator for the PrimaryKey MetaData.
 JoinMetaData setSchema(java.lang.String schema)
           
 JoinMetaData setTable(java.lang.String table)
           
 JoinMetaData setUnique(boolean unique)
           
 JoinMetaData setUnique(java.lang.String unique)
           
 void setUniqueMetaData(UniqueMetaData uniqueMetaData)
           
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object using a prefix
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, assertIfInitialised, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, isInitialised, isPopulated, isUsed, newExtensionMetaData, removeExtension, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

primaryKeyMetaData

protected PrimaryKeyMetaData primaryKeyMetaData
PrimaryKey MetaData


indexed

protected IndexedValue indexed
The indexing value


unique

protected boolean unique
Whether to add a unique constraint.


columnMetaData

protected ColumnMetaData[] columnMetaData
Contains the metadata for column

Constructor Detail

JoinMetaData

public JoinMetaData(JoinMetaData joinmd)
Constructor to create a copy of the passed JoinMetaData.

Parameters:
joinmd - Existing join metadata to copy

JoinMetaData

public JoinMetaData()
Default constructor. Use setters to set fields, before populate().

Method Detail

initialise

public void initialise(ClassLoaderResolver clr,
                       MetaDataManager mmgr)
Method to initialise the object, creating internal convenience arrays. Initialises all sub-objects.

Overrides:
initialise in class MetaData

addColumn

public void addColumn(ColumnMetaData colmd)
Add a new ColumnMetaData element

Specified by:
addColumn in interface ColumnMetaDataContainer
Parameters:
colmd - The ColumnMetaData to add

newColumnMetaData

public ColumnMetaData newColumnMetaData()
Method to create a new column metadata, add it, and return it.

Returns:
The column metadata

isOuter

public final boolean isOuter()

setOuter

public JoinMetaData setOuter(boolean outer)

setOuter

public JoinMetaData setOuter(java.lang.String outer)

getDeleteAction

public java.lang.String getDeleteAction()

setDeleteAction

public JoinMetaData setDeleteAction(java.lang.String deleteAction)

getIndexed

public IndexedValue getIndexed()

setIndexed

public JoinMetaData setIndexed(IndexedValue indexed)

isUnique

public boolean isUnique()

setUnique

public JoinMetaData setUnique(boolean unique)

setUnique

public JoinMetaData setUnique(java.lang.String unique)

getTable

public final java.lang.String getTable()

setTable

public JoinMetaData setTable(java.lang.String table)

getCatalog

public final java.lang.String getCatalog()

setCatalog

public JoinMetaData setCatalog(java.lang.String catalog)

getSchema

public final java.lang.String getSchema()

setSchema

public JoinMetaData setSchema(java.lang.String schema)

getColumnName

public final java.lang.String getColumnName()

setColumnName

public JoinMetaData setColumnName(java.lang.String columnName)

getColumnMetaData

public final ColumnMetaData[] getColumnMetaData()
Accessor for columnMetaData

Specified by:
getColumnMetaData in interface ColumnMetaDataContainer
Returns:
Returns the columnMetaData.

getIndexMetaData

public final IndexMetaData getIndexMetaData()
Returns:
Returns the indexMetaData.

getUniqueMetaData

public final UniqueMetaData getUniqueMetaData()
Returns:
Returns the uniquexMetaData.

getForeignKeyMetaData

public final ForeignKeyMetaData getForeignKeyMetaData()
Returns:
Returns the foreignKeyMetaData.

getPrimaryKeyMetaData

public final PrimaryKeyMetaData getPrimaryKeyMetaData()
Accessor for primaryKeyMetaData

Returns:
Returns the primaryKey MetaData.

setForeignKeyMetaData

public final void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
Parameters:
foreignKeyMetaData - The foreignKeyMetaData to set.

newForeignKeyMetaData

public ForeignKeyMetaData newForeignKeyMetaData()
Method to create a new FK metadata, set to use it, and return it.

Returns:
The FK metadata

setIndexMetaData

public final void setIndexMetaData(IndexMetaData indexMetaData)
Parameters:
indexMetaData - The indexMetaData to set.

newIndexMetaData

public IndexMetaData newIndexMetaData()
Method to create a new index metadata, set to use it, and return it.

Returns:
The index metadata

setUniqueMetaData

public final void setUniqueMetaData(UniqueMetaData uniqueMetaData)
Parameters:
uniqueMetaData - The uniqueMetaData to set.

newUniqueMetaData

public UniqueMetaData newUniqueMetaData()
Method to create a new unique metadata, set to use it, and return it.

Returns:
The unique metadata

setPrimaryKeyMetaData

public final void setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
Mutator for the PrimaryKey MetaData.

Parameters:
primaryKeyMetaData - The PrimaryKey MetaData to set.

newPrimaryKeyMetaData

public PrimaryKeyMetaData newPrimaryKeyMetaData()
Method to create a new PK metadata, set to use it, and return it.

Returns:
The PK metadata

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object using a prefix

Overrides:
toString in class MetaData
Parameters:
prefix - prefix string
indent - indent string
Returns:
a string representation of the object.


Copyright © 2010. All Rights Reserved.