Class MapTable
- java.lang.Object
-
- org.datanucleus.store.rdbms.table.AbstractTable
-
- org.datanucleus.store.rdbms.table.TableImpl
-
- org.datanucleus.store.rdbms.table.JoinTable
-
- org.datanucleus.store.rdbms.table.MapTable
-
- All Implemented Interfaces:
Table
,org.datanucleus.store.schema.table.Table
public class MapTable extends JoinTable
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 :-
- ownerMapping linking back to the owning class with the Collection.
- keyMapping either being an FK link to the key table or being an embedded/serialised key stored wholely in this table.
- valueMapping either being an FK link to the value table or being an embedded/serialised value stored wholely in this table.
- orderMapping which may be null, or otherwise stores an index for the keys. This is either to provide uniqueness or ordering (and part of the PK).
-
-
Field Summary
Fields Modifier and Type Field Description protected Table
ownerTable
-
Fields inherited from class org.datanucleus.store.rdbms.table.JoinTable
mmd, ownerMapping, ownerType
-
Fields inherited from class org.datanucleus.store.rdbms.table.AbstractTable
columns, columnsByIdentifier, dba, existsInDatastore, identifier, state, storeMgr, TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED
-
-
Constructor Summary
Constructors Constructor Description MapTable(Table ownerTable, DatastoreIdentifier tableName, org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyUserPrimaryKeySpecification(org.datanucleus.metadata.PrimaryKeyMetaData pkmd)
Convenience method to apply the user specification of <primary-key> columnsprotected List
getExpectedCandidateKeys()
Accessor for the candidate keys for this table.List
getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table.protected Set
getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
Accessor for the indices for this table.JavaTypeMapping
getKeyMapping()
Accessor for the "key" mapping end of the relationship.String
getKeyType()
Accessor for the key type for this Map.JavaTypeMapping
getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor the for the mapping for a field stored in this tableJavaTypeMapping
getOrderMapping()
Accessor for order mapping.JavaTypeMapping
getValueMapping()
Accessor for the "value" mapping end of the relationship.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 persistable(embedded)boolean
isEmbeddedValue()
Accessor for whether the value is embedded into this table.boolean
isEmbeddedValuePC()
Accessor for whether the value is a persistable(embedded)boolean
isSerialisedKey()
Accessor for whether the key is serialised into this table.boolean
isSerialisedKeyPC()
Accessor for whether the key is a persistable(serialised)boolean
isSerialisedValue()
Accessor for whether the value is serialised into this table.boolean
isSerialisedValuePC()
Accessor for whether the value is a persistable(serialised)-
Methods inherited from class org.datanucleus.store.rdbms.table.JoinTable
getIdMapping, getOwnerMapping, getOwnerMemberMetaData, getOwnerTable, getPrimaryKey, requiresPrimaryKey
-
Methods inherited from class org.datanucleus.store.rdbms.table.TableImpl
createConstraints, dropConstraints, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, logMapping, validate, validateColumns, validateConstraints, validatePrimaryKey
-
Methods inherited from class org.datanucleus.store.rdbms.table.AbstractTable
addColumn, addColumnInternal, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getClassMetaData, getColumn, getColumnForName, getColumnForPosition, getColumns, getDatastoreIdentifierFullyQualified, getDiscriminatorMetaData, getIdentifier, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getName, getNumberOfColumns, getSchemaName, getStoreManager, getSurrogateColumn, getSurrogateMapping, getVersionMetaData, hasColumn, hasColumnName, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, postInitialize, preInitialize, tableExistsInDatastore, toString
-
-
-
-
Field Detail
-
ownerTable
protected Table ownerTable
-
-
Constructor Detail
-
MapTable
public MapTable(Table ownerTable, DatastoreIdentifier tableName, org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr)
Constructor.- Parameters:
ownerTable
- Table of the owner of this membertableName
- Identifier name of the tablemmd
- MetaData for the member of the ownerstoreMgr
- The Store Manager managing these tables.
-
-
Method Detail
-
initialize
public void initialize(org.datanucleus.ClassLoaderResolver clr)
Method to initialise the table definition.- Parameters:
clr
- The ClassLoaderResolver
-
applyUserPrimaryKeySpecification
protected void applyUserPrimaryKeySpecification(org.datanucleus.metadata.PrimaryKeyMetaData pkmd)
Convenience method to apply the user specification of <primary-key> 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 persistable, 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 persistable, or a serialised simple type.- Returns:
- Whether the key is serialised.
-
isSerialisedKeyPC
public boolean isSerialisedKeyPC()
Accessor for whether the key is a persistable(serialised)- Returns:
- Whether the key is PC and is serialised
-
isEmbeddedKeyPC
public boolean isEmbeddedKeyPC()
Accessor for whether the key is a persistable(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 persistable, 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 persistable, or a serialised simple type.- Returns:
- Whether the value is serialised.
-
isSerialisedValuePC
public boolean isSerialisedValuePC()
Accessor for whether the value is a persistable(serialised)- Returns:
- Whether the value is PC and is serialised
-
isEmbeddedValuePC
public boolean isEmbeddedValuePC()
Accessor for whether the value is a persistable(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 String getKeyType()
Accessor for the key type for this Map.- Returns:
- Name of key type.
-
getValueType
public String getValueType()
Accessor for the value type for this Map.- Returns:
- Name of value type.
-
getOrderMapping
public 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
public List getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table.- Overrides:
getExpectedForeignKeys
in classTableImpl
- Parameters:
clr
- The ClassLoaderResolver- Returns:
- The expected foreign keys.
-
getExpectedIndices
protected 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.- Overrides:
getExpectedIndices
in classTableImpl
- Parameters:
clr
- The ClassLoaderResolver- Returns:
- The indices
-
getExpectedCandidateKeys
protected List getExpectedCandidateKeys()
Accessor for the candidate keys for this table.- Overrides:
getExpectedCandidateKeys
in classTableImpl
- Returns:
- The indices
-
getMemberMapping
public JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor the for the mapping for a field stored in this table- Parameters:
mmd
- MetaData for the field whose mapping we want- Returns:
- The mapping
-
-