org.jpox.store.rdbms.table
Class MapTable

java.lang.Object
  extended byorg.jpox.store.rdbms.table.AbstractTable
      extended byorg.jpox.store.rdbms.table.TableImpl
          extended byorg.jpox.store.rdbms.table.JoinTable
              extended byorg.jpox.store.rdbms.table.MapTable
All Implemented Interfaces:
DatastoreContainerObject, DatastoreObject, SCOTable, Table

public class MapTable
extends JoinTable
implements SCOTable

Representation of a join table for a Map relationship. A Map can be configured in various ways using JPOX.

This join table will always have a FK back to the owning object. A variant on the above configurations is where we have a PC key/value is where we can embed that in this join table too. This is specified using the mapping within , or .

Version:
$Revision: 1.42 $

Field Summary
protected  java.util.Map embeddedKeyMappingsMap
          Map of field mappings when containing an embedded PC key.
protected  java.util.Map embeddedValueMappingsMap
          Map of field mappings when containing an embedded PC value.
 
Fields inherited from class org.jpox.store.rdbms.table.JoinTable
fmd, ownerMapping, ownerType
 
Fields inherited from class org.jpox.store.rdbms.table.AbstractTable
columns, columnsByName, dba, ddlDumpWriter, identifier, LOCALISER, state, storeMgr
 
Fields inherited from interface org.jpox.store.rdbms.table.Table
TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED, TABLE_TYPE_MISSING, TABLE_TYPE_TABLE, TABLE_TYPE_UNKNOWN, TABLE_TYPE_VIEW
 
Constructor Summary
MapTable(DatastoreIdentifier tableName, AbstractPropertyMetaData fmd, RDBMSManager storeMgr)
          Constructor.
 
Method Summary
protected  void applyUserPrimaryKeySpecification(PrimaryKeyMetaData pkmd)
          Convenience method to apply the user specification of columns
 JavaTypeMapping getAdapterMapping()
          Accessor for adapeter mapping.
protected  java.util.List getExpectedCandidateKeys()
          Accessor for the candidate keys for this table.
protected  java.util.List getExpectedForeignKeys(ClassLoaderResolver clr)
          Accessor for the expected foreign keys for this table.
protected  java.util.Set getExpectedIndices(ClassLoaderResolver clr)
          Accessor for the indices for this table.
 JavaTypeMapping getFieldMapping(AbstractPropertyMetaData fmd)
          Accessor the for the mapping for a field stored in this table
 JavaTypeMapping getKeyMapping()
          Accessor for the "key" mapping end of the relationship.
 java.lang.String getKeyType()
          Accessor for the key type for this Map.
 JavaTypeMapping getValueMapping()
          Accessor for the "value" mapping end of the relationship.
 java.lang.String getValueType()
          Accessor for the value type for this Map.
 void initialize(ClassLoaderResolver clr)
          Method to initialise the table definition.
 boolean isEmbeddedKey()
          Accessor for whether the key is embedded into this table.
 boolean isEmbeddedKeyPC()
          Accessor for whether the key is a PersistenceCapable(embedded)
 boolean isEmbeddedValue()
          Accessor for whether the value is embedded into this table.
 boolean isEmbeddedValuePC()
          Accessor for whether the value is a PersistenceCapable(embedded)
 boolean isSerialisedKey()
          Accessor for whether the key is serialised into this table.
 boolean isSerialisedKeyPC()
          Accessor for whether the key is a PersistenceCapable(serialised)
 boolean isSerialisedValue()
          Accessor for whether the value is serialised into this table.
 boolean isSerialisedValuePC()
          Accessor for whether the value is a PersistenceCapable(serialised)
 
Methods inherited from class org.jpox.store.rdbms.table.JoinTable
getIDMapping, getOwnerFieldMetaData, getOwnerMapping, getPrimaryKey, requiresPrimaryKey
 
Methods inherited from class org.jpox.store.rdbms.table.TableImpl
dropConstraints, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, postInitialize, preInitialize, validate, validateColumns, validateConstraints, validatePrimaryKey
 
Methods inherited from class org.jpox.store.rdbms.table.AbstractTable
addColumnInternal, addDatastoreField, allowDdlDump, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreIdentifierFullyQualified, getDiscriminatorMapping, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMapping, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isDumpingDdl, isInitialized, isInitializedModified, isPKInitialized, isValidated, setDdlDumpWriter, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jpox.store.rdbms.table.SCOTable
getOwnerMapping
 
Methods inherited from interface org.jpox.store.rdbms.table.Table
create, drop, exists, getCatalogName, getSchemaName, isInitialized, isInitializedModified, isValidated, postInitialize, preInitialize, validate
 
Methods inherited from interface org.jpox.store.DatastoreContainerObject
addDatastoreField, getDiscriminatorMapping, getDiscriminatorMetaData, getIDMapping, getVersionMapping, getVersionMetaData, hasDatastoreField
 
Methods inherited from interface org.jpox.store.DatastoreObject
getIdentifier, getStoreManager
 

Field Detail

embeddedKeyMappingsMap

protected java.util.Map embeddedKeyMappingsMap
Map of field mappings when containing an embedded PC key. Keyed by the FieldMetaData of the field.


embeddedValueMappingsMap

protected java.util.Map embeddedValueMappingsMap
Map of field mappings when containing an embedded PC value. Keyed by the FieldMetaData of the field.

Constructor Detail

MapTable

public MapTable(DatastoreIdentifier tableName,
                AbstractPropertyMetaData fmd,
                RDBMSManager storeMgr)
Constructor.

Parameters:
tableName - Identifier name of the table
fmd - MetaData for the field of the owner
storeMgr - The Store Manager managing these tables.
Method Detail

initialize

public void initialize(ClassLoaderResolver clr)
Method to initialise the table definition.

Specified by:
initialize in interface Table
Parameters:
clr - The ClassLoaderResolver

applyUserPrimaryKeySpecification

protected void applyUserPrimaryKeySpecification(PrimaryKeyMetaData pkmd)
Convenience method to apply the user specification of columns

Parameters:
pkmd - MetaData for the primary key

isEmbeddedKey

public boolean isEmbeddedKey()
Accessor for whether the key is embedded into this table. This can be an embedded PersistenceCapable, or an embedded simple type.

Returns:
Whether the key is embedded.

isSerialisedKey

public boolean isSerialisedKey()
Accessor for whether the key is serialised into this table. This can be an serialised PersistenceCapable, or a serialised simple type.

Returns:
Whether the key is serialised.

isSerialisedKeyPC

public boolean isSerialisedKeyPC()
Accessor for whether the key is a PersistenceCapable(serialised)

Returns:
Whether the key is PC and is serialised

isEmbeddedKeyPC

public boolean isEmbeddedKeyPC()
Accessor for whether the key is a PersistenceCapable(embedded)

Returns:
Whether the key is PC and is embedded

isEmbeddedValue

public boolean isEmbeddedValue()
Accessor for whether the value is embedded into this table. This can be an embedded PersistenceCapable, or an embedded simple type.

Returns:
Whether the value is embedded.

isSerialisedValue

public boolean isSerialisedValue()
Accessor for whether the value is serialised into this table. This can be an serialised PersistenceCapable, or a serialised simple type.

Returns:
Whether the value is serialised.

isSerialisedValuePC

public boolean isSerialisedValuePC()
Accessor for whether the value is a PersistenceCapable(serialised)

Returns:
Whether the value is PC and is serialised

isEmbeddedValuePC

public boolean isEmbeddedValuePC()
Accessor for whether the value is a PersistenceCapable(embedded)

Returns:
Whether the value is PC and is embedded

getKeyMapping

public JavaTypeMapping getKeyMapping()
Accessor for the "key" mapping end of the relationship.

Returns:
The column mapping for the element.

getValueMapping

public JavaTypeMapping getValueMapping()
Accessor for the "value" mapping end of the relationship.

Returns:
The column mapping for the element.

getKeyType

public java.lang.String getKeyType()
Accessor for the key type for this Map.

Returns:
Name of key type.

getValueType

public java.lang.String getValueType()
Accessor for the value type for this Map.

Returns:
Name of value type.

getAdapterMapping

public JavaTypeMapping getAdapterMapping()
Accessor for adapeter mapping. The columns in this mapping are part of the primary key.

Returns:
The column mapping for objects without identity or not supported as part of the primary keys

getExpectedForeignKeys

protected java.util.List getExpectedForeignKeys(ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table.

Overrides:
getExpectedForeignKeys in class TableImpl
Parameters:
clr - The ClassLoaderResolver
Returns:
The expected foreign keys.

getExpectedIndices

protected java.util.Set getExpectedIndices(ClassLoaderResolver clr)
Accessor for the indices for this table. This includes both the user-defined indices (via MetaData), and the ones required by foreign keys (required by relationships).

Overrides:
getExpectedIndices in class TableImpl
Parameters:
clr - The ClassLoaderResolver
Returns:
The indices

getExpectedCandidateKeys

protected java.util.List getExpectedCandidateKeys()
Accessor for the candidate keys for this table.

Overrides:
getExpectedCandidateKeys in class TableImpl
Returns:
The indices

getFieldMapping

public JavaTypeMapping getFieldMapping(AbstractPropertyMetaData fmd)
Accessor the for the mapping for a field stored in this table

Specified by:
getFieldMapping in interface DatastoreContainerObject
Parameters:
fmd - MetaData for the field whose mapping we want
Returns:
The mapping


Copyright © -2007 . All Rights Reserved.