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
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
FieldsModifier and TypeFieldDescriptionprivate JavaTypeMapping
Mapping to the key object.private JavaTypeMapping
Mapping to allow ordering (of keys) or to allow duplicates.protected Table
private JavaTypeMapping
Mapping to the value object.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
ConstructorsConstructorDescriptionMapTable
(Table ownerTable, DatastoreIdentifier tableName, org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyUserPrimaryKeySpecification
(org.datanucleus.metadata.PrimaryKeyMetaData pkmd) Convenience method to apply the user specification of <primary-key> columnsprotected List
<CandidateKey> Accessor for the candidate keys for this table.getExpectedForeignKeys
(org.datanucleus.ClassLoaderResolver clr) Accessor for the expected foreign keys for this table.getExpectedIndices
(org.datanucleus.ClassLoaderResolver clr) Accessor for the indices for this table.Accessor for the "key" mapping end of the relationship.Accessor for the key type for this Map.getMemberMapping
(org.datanucleus.metadata.AbstractMemberMetaData mmd) Accessor the for the mapping for a field stored in this tableAccessor for order mapping.Accessor for the "value" mapping end of the relationship.Accessor for the value type for this Map.void
initialize
(org.datanucleus.ClassLoaderResolver clr) Method to initialise the table definition.boolean
Accessor for whether the key is embedded into this table.boolean
Accessor for whether the key is a persistable(embedded)boolean
Accessor for whether the value is embedded into this table.boolean
Accessor for whether the value is a persistable(embedded)boolean
Accessor for whether the key is serialised into this table.boolean
Accessor for whether the key is a persistable(serialised)boolean
Accessor for whether the value is serialised into this table.boolean
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 Details
-
ownerTable
-
keyMapping
Mapping to the key object. -
valueMapping
Mapping to the value object. -
orderMapping
Mapping to allow ordering (of keys) or to allow duplicates. Can be used when the key is not suitable for use as part of the PK and a PK is required for this join table.
-
-
Constructor Details
-
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 Details
-
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
Accessor for the "key" mapping end of the relationship.- Returns:
- The column mapping for the element.
-
getValueMapping
Accessor for the "value" mapping end of the relationship.- Returns:
- The column mapping for the element.
-
getKeyType
Accessor for the key type for this Map.- Returns:
- Name of key type.
-
getValueType
Accessor for the value type for this Map.- Returns:
- Name of value type.
-
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
Accessor for the expected foreign keys for this table.- Overrides:
getExpectedForeignKeys
in classTableImpl
- Parameters:
clr
- The ClassLoaderResolver- Returns:
- The expected foreign keys.
-
getExpectedIndices
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
Accessor for the candidate keys for this table.- Overrides:
getExpectedCandidateKeys
in classTableImpl
- Returns:
- The indices
-
getMemberMapping
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
-