org.datanucleus.store.rdbms.table
Class MapTable

java.lang.Object
  extended by org.datanucleus.store.rdbms.table.AbstractTable
      extended by org.datanucleus.store.rdbms.table.TableImpl
          extended by org.datanucleus.store.rdbms.table.JoinTable
              extended by org.datanucleus.store.rdbms.table.MapTable
All Implemented Interfaces:
org.datanucleus.store.mapped.DatastoreContainerObject, org.datanucleus.store.mapped.DatastoreMap, Table

public class MapTable
extends JoinTable
implements org.datanucleus.store.mapped.DatastoreMap

Representation of a join table for a Map. A Map covers a wide range of possibilities in terms of whether it allows duplicates or not, whether it allows nulls or not, whether it supports ordering via indexes etc. Consequently the join table can vary depending on the required capabilities.

JoinTable Mappings

The join table consists of the following mappings :-


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.datanucleus.store.rdbms.table.JoinTable
mmd, ownerMapping, ownerType
 
Fields inherited from class org.datanucleus.store.rdbms.table.AbstractTable
columns, columnsByName, dba, existsInDatastore, identifier, LOCALISER, state, storeMgr
 
Constructor Summary
MapTable(org.datanucleus.store.mapped.DatastoreIdentifier tableName, org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSManager storeMgr)
          Constructor.
 
Method Summary
protected  void applyUserPrimaryKeySpecification(org.datanucleus.metadata.PrimaryKeyMetaData pkmd)
          Convenience method to apply the user specification of columns
protected  java.util.List getExpectedCandidateKeys()
          Accessor for the candidate keys for this table.
protected  java.util.List getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
          Accessor for the expected foreign keys for this table.
protected  java.util.Set getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
          Accessor for the indices for this table.
 org.datanucleus.store.mapped.mapping.JavaTypeMapping getKeyMapping()
          Accessor for the "key" mapping end of the relationship.
 java.lang.String getKeyType()
          Accessor for the key type for this Map.
 org.datanucleus.store.mapped.mapping.JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
          Accessor the for the mapping for a field stored in this table
 org.datanucleus.store.mapped.mapping.JavaTypeMapping getOrderMapping()
          Accessor for order mapping.
 org.datanucleus.store.mapped.mapping.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(org.datanucleus.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.datanucleus.store.rdbms.table.JoinTable
debugMapping, getIDMapping, getOwnerMapping, getOwnerMemberMetaData, getPrimaryKey, requiresPrimaryKey
 
Methods inherited from class org.datanucleus.store.rdbms.table.TableImpl
createConstraints, dropConstraints, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, postInitialize, preInitialize, validate, validateColumns, validateConstraints, validatePrimaryKey
 
Methods inherited from class org.datanucleus.store.rdbms.table.AbstractTable
addColumnInternal, addDatastoreField, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreField, getDatastoreFields, getDatastoreIdentifierFullyQualified, getDiscriminatorMapping, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMapping, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, tableExistsInDatastore, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreMap
getOwnerMapping
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreContainerObject
addDatastoreField, getDatastoreField, getDatastoreFields, getDiscriminatorMapping, getDiscriminatorMetaData, getIdentifier, getIDMapping, getStoreManager, getVersionMapping, getVersionMetaData, hasDatastoreField
 

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(org.datanucleus.store.mapped.DatastoreIdentifier tableName,
                org.datanucleus.metadata.AbstractMemberMetaData mmd,
                RDBMSManager storeMgr)
Constructor.

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

initialize

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

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

applyUserPrimaryKeySpecification

protected void applyUserPrimaryKeySpecification(org.datanucleus.metadata.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 org.datanucleus.store.mapped.mapping.JavaTypeMapping getKeyMapping()
Accessor for the "key" mapping end of the relationship.

Specified by:
getKeyMapping in interface org.datanucleus.store.mapped.DatastoreMap
Returns:
The column mapping for the element.

getValueMapping

public org.datanucleus.store.mapped.mapping.JavaTypeMapping getValueMapping()
Accessor for the "value" mapping end of the relationship.

Specified by:
getValueMapping in interface org.datanucleus.store.mapped.DatastoreMap
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.

getOrderMapping

public org.datanucleus.store.mapped.mapping.JavaTypeMapping getOrderMapping()
Accessor for order 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(org.datanucleus.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(org.datanucleus.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

getMemberMapping

public org.datanucleus.store.mapped.mapping.JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor the for the mapping for a field stored in this table

Specified by:
getMemberMapping in interface org.datanucleus.store.mapped.DatastoreContainerObject
Parameters:
mmd - MetaData for the field whose mapping we want
Returns:
The mapping


Copyright © 2009. All Rights Reserved.