Class 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 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 member
        tableName - Identifier name of the table
        mmd - MetaData for the member 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.
        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 class TableImpl
        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 class TableImpl
        Parameters:
        clr - The ClassLoaderResolver
        Returns:
        The indices
      • getExpectedCandidateKeys

        protected List getExpectedCandidateKeys()
        Accessor for the candidate keys for this table.
        Overrides:
        getExpectedCandidateKeys in class TableImpl
        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