org.jpox.store.rdbms.table
Class SecondaryTable
java.lang.Object
org.jpox.store.rdbms.table.AbstractTable
org.jpox.store.rdbms.table.TableImpl
org.jpox.store.rdbms.table.AbstractClassTable
org.jpox.store.rdbms.table.SecondaryTable
- All Implemented Interfaces:
- org.jpox.store.mapped.DatastoreClass, org.jpox.store.mapped.DatastoreContainerObject, org.jpox.store.mapped.DatastoreObject, org.jpox.store.mapped.SecondaryDatastoreClass, Table
public class SecondaryTable
- extends AbstractClassTable
- implements org.jpox.store.mapped.SecondaryDatastoreClass
Representation of a secondary table for a class.
Has a primary table that manages the main fields for that class and some fields are defined
(using ) to be stored in the secondary table.
Many of the methods in this class defer to the equivalent method in the primary table.
- Version:
- $Revision: 1.48 $
|
Method Summary |
org.jpox.store.mapped.DatastoreClass |
getBaseDatastoreClassWithField(org.jpox.metadata.AbstractMemberMetaData fmd)
Convenience accessor for the base table for this table which has the specified field. |
protected java.util.List |
getExpectedForeignKeys()
Accessor for the expected foreign keys for this table. |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getExternalMapping(org.jpox.metadata.AbstractMemberMetaData fmd,
int mappingType)
|
org.jpox.store.mapped.mapping.JavaTypeMapping |
getFieldMapping(org.jpox.metadata.AbstractMemberMetaData mmd)
Accessor for the field/property Mapping. |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getFieldMapping(java.lang.String fieldName)
Accessor for the field mapping for the specified field. |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getFieldMappingInDatastoreClass(org.jpox.metadata.AbstractMemberMetaData mmd)
Accessor for the mapping for the specified field only in this datastore class. |
org.jpox.metadata.IdentityType |
getIdentityType()
Accessor for the identity-type. |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getIDMapping()
Accessor for the ID mapping for this table. |
org.jpox.metadata.JoinMetaData |
getJoinMetaData()
Accessor for the JoinMetaData which is used to join to the primary DatastoreClass. |
org.jpox.metadata.AbstractMemberMetaData |
getMetaDataForExternalMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
int mappingType)
|
org.jpox.store.mapped.DatastoreClass |
getPrimaryDatastoreClass()
Accessor for the primary datastore class that this is dependent on. |
PrimaryKey |
getPrimaryKey()
Accessor for the primary key for this table. |
java.util.Collection |
getSecondaryDatastoreClasses()
Accessor for any secondary tables for this table. |
org.jpox.store.mapped.DatastoreClass |
getSuperDatastoreClass()
Accessor for the supertable for this table. |
java.lang.String |
getType()
Accessor for the main type represented here. |
void |
initialize(org.jpox.ClassLoaderResolver clr)
Method to initialise the table. |
protected void |
initializePK(org.jpox.ClassLoaderResolver clr)
Method to initialise the primary key of this table. |
boolean |
isBaseDatastoreClass()
Whether this table is the base in the inheritance hierarchy. |
boolean |
isObjectIDDatastoreAttributed()
Whether this table or super table has id (primary key) attributed by the datastore |
boolean |
managesClass(java.lang.String className)
Accessor for whether this table manages the specified class |
void |
postInitialize(org.jpox.ClassLoaderResolver clr)
Post initilize. |
void |
preInitialize(org.jpox.ClassLoaderResolver clr)
Pre initilize. |
void |
provideExternalMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer,
int mappingType)
|
void |
providePrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Provide the mappings to the consumer for all primary-key fields mapped to
this table (for application identity). |
void |
provideUnmappedDatastoreFields(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Method to provide all unmapped datastore fields (columns) to the consumer. |
| Methods inherited from class org.jpox.store.rdbms.table.AbstractClassTable |
addFieldMapping, getDataStoreObjectIdMapping, getDiscriminatorMapping, getMappingForFieldName, getPrimaryDatastoreContainerObject, getVersionMapping, managesField, provideDatastoreIdMappings, provideDiscriminatorMappings, provideMappingsForFields, provideNonPrimaryKeyMappings, provideVersionMappings |
| Methods inherited from class org.jpox.store.rdbms.table.TableImpl |
createConstraints, dropConstraints, getExpectedCandidateKeys, getExpectedForeignKeys, getExpectedIndices, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, validate, validateColumns, validateConstraints, validatePrimaryKey |
| Methods inherited from class org.jpox.store.rdbms.table.AbstractTable |
addColumnInternal, addDatastoreField, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreFieldsMetaData, getDatastoreIdentifierFullyQualified, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isCompleteDdl, isInitialized, isInitializedModified, isOutputtingDDL, isPKInitialized, isValidated, setCompleteDdl, setDdlWriter, tableExistsInDatastore, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jpox.store.mapped.DatastoreClass |
getDataStoreObjectIdMapping, provideDatastoreIdMappings, provideDiscriminatorMappings, provideMappingsForFields, provideNonPrimaryKeyMappings, provideVersionMappings, toString |
| Methods inherited from interface org.jpox.store.mapped.DatastoreContainerObject |
addDatastoreField, getDatastoreFieldsMetaData, getDiscriminatorMapping, getDiscriminatorMetaData, getVersionMapping, getVersionMetaData, hasDatastoreField |
| Methods inherited from interface org.jpox.store.mapped.DatastoreObject |
getIdentifier, getStoreManager |
preInitialize
public void preInitialize(org.jpox.ClassLoaderResolver clr)
- Pre initilize. For things that must be initialized right after constructor
- Specified by:
preInitialize in interface Table- Overrides:
preInitialize in class TableImpl
- Parameters:
clr - the ClassLoaderResolver
postInitialize
public void postInitialize(org.jpox.ClassLoaderResolver clr)
- Post initilize. For things that must be set after all classes have been initialized before
- Specified by:
postInitialize in interface Table- Overrides:
postInitialize in class TableImpl
- Parameters:
clr - the ClassLoaderResolver
initialize
public void initialize(org.jpox.ClassLoaderResolver clr)
- Method to initialise the table.
This will initialise the primary key columns for the table. Any other columns
are added via the addFieldMapping() method.
- Specified by:
initialize in interface Table
- Parameters:
clr - The ClassLoaderResolver
initializePK
protected void initializePK(org.jpox.ClassLoaderResolver clr)
- Method to initialise the primary key of this table.
- Specified by:
initializePK in class AbstractClassTable
- Parameters:
clr - The ClassLoaderResolver- See Also:
AbstractClassTable.initializePK(ClassLoaderResolver)
getPrimaryKey
public PrimaryKey getPrimaryKey()
- Accessor for the primary key for this table. Overrides the method in TableImpl
to add on any specification of PK name in the metadata.
- Overrides:
getPrimaryKey in class TableImpl
- Returns:
- The primary key.
getPrimaryDatastoreClass
public org.jpox.store.mapped.DatastoreClass getPrimaryDatastoreClass()
- Accessor for the primary datastore class that this is dependent on.
- Specified by:
getPrimaryDatastoreClass in interface org.jpox.store.mapped.SecondaryDatastoreClass
- Returns:
- The associated primary datastore class.
getJoinMetaData
public org.jpox.metadata.JoinMetaData getJoinMetaData()
- Accessor for the JoinMetaData which is used to join to the primary DatastoreClass.
- Specified by:
getJoinMetaData in interface org.jpox.store.mapped.SecondaryDatastoreClass
- Returns:
- JoinMetaData
getIdentityType
public org.jpox.metadata.IdentityType getIdentityType()
- Accessor for the identity-type.
Simply returns the same as the primary table
- Specified by:
getIdentityType in interface org.jpox.store.mapped.DatastoreClass- Specified by:
getIdentityType in class AbstractClassTable
- Returns:
- identity-type tag value
getType
public java.lang.String getType()
- Accessor for the main type represented here.
- Specified by:
getType in interface org.jpox.store.mapped.DatastoreClass
- Returns:
- Name of the principal class represented
isObjectIDDatastoreAttributed
public boolean isObjectIDDatastoreAttributed()
- Whether this table or super table has id (primary key) attributed by the datastore
- Specified by:
isObjectIDDatastoreAttributed in interface org.jpox.store.mapped.DatastoreClass- Specified by:
isObjectIDDatastoreAttributed in class AbstractClassTable
- Returns:
- true if the id attributed by the datastore
isBaseDatastoreClass
public boolean isBaseDatastoreClass()
- Whether this table is the base in the inheritance hierarchy.
- Specified by:
isBaseDatastoreClass in interface org.jpox.store.mapped.DatastoreClass
- Returns:
- true if this table is a root table
getBaseDatastoreClassWithField
public org.jpox.store.mapped.DatastoreClass getBaseDatastoreClassWithField(org.jpox.metadata.AbstractMemberMetaData fmd)
- Convenience accessor for the base table for this table which has the specified field.
- Specified by:
getBaseDatastoreClassWithField in interface org.jpox.store.mapped.DatastoreClass
- Parameters:
fmd - Field MetaData for this field
- Returns:
- The base table which has the field specified
getSuperDatastoreClass
public org.jpox.store.mapped.DatastoreClass getSuperDatastoreClass()
- Accessor for the supertable for this table.
- Specified by:
getSuperDatastoreClass in interface org.jpox.store.mapped.DatastoreClass
- Returns:
- The supertable
getSecondaryDatastoreClasses
public java.util.Collection getSecondaryDatastoreClasses()
- Accessor for any secondary tables for this table.
- Specified by:
getSecondaryDatastoreClasses in interface org.jpox.store.mapped.DatastoreClass
- Returns:
- Secondary tables (if any)
managesClass
public boolean managesClass(java.lang.String className)
- Accessor for whether this table manages the specified class
- Specified by:
managesClass in interface org.jpox.store.mapped.DatastoreClass
- Parameters:
className - Name of the class
- Returns:
- Whether it is managed by this table
getExpectedForeignKeys
protected java.util.List getExpectedForeignKeys()
- Accessor for the expected foreign keys for this table.
- Returns:
- The expected foreign keys.
getFieldMapping
public org.jpox.store.mapped.mapping.JavaTypeMapping getFieldMapping(org.jpox.metadata.AbstractMemberMetaData mmd)
- Accessor for the field/property Mapping.
Returns the mapping if it is present in this table.
- Specified by:
getFieldMapping in interface org.jpox.store.mapped.DatastoreClass- Specified by:
getFieldMapping in interface org.jpox.store.mapped.DatastoreContainerObject
- Parameters:
mmd - Field MetaData for this field/property
- Returns:
- the Mapping for the field/property
getFieldMappingInDatastoreClass
public org.jpox.store.mapped.mapping.JavaTypeMapping getFieldMappingInDatastoreClass(org.jpox.metadata.AbstractMemberMetaData mmd)
- Accessor for the mapping for the specified field only in this datastore class.
- Specified by:
getFieldMappingInDatastoreClass in interface org.jpox.store.mapped.DatastoreClass
- Parameters:
mmd - Metadata of the field/property
- Returns:
- The Mapping for the field (or null if not present here)
getFieldMapping
public org.jpox.store.mapped.mapping.JavaTypeMapping getFieldMapping(java.lang.String fieldName)
- Accessor for the field mapping for the specified field.
TODO Use of this is discouraged since the fieldName is not fully qualified
and if a superclass-table inheritance is used we could have 2 fields of that name here.
- Specified by:
getFieldMapping in interface org.jpox.store.mapped.DatastoreClass
- Parameters:
fieldName - Name of the field
- Returns:
- The mapping for the field
getIDMapping
public org.jpox.store.mapped.mapping.JavaTypeMapping getIDMapping()
- Accessor for the ID mapping for this table.
- Specified by:
getIDMapping in interface org.jpox.store.mapped.DatastoreContainerObject
- Returns:
- The ID mapping
providePrimaryKeyMappings
public void providePrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
- Provide the mappings to the consumer for all primary-key fields mapped to
this table (for application identity).
- Specified by:
providePrimaryKeyMappings in interface org.jpox.store.mapped.DatastoreClass- Specified by:
providePrimaryKeyMappings in class AbstractClassTable
- Parameters:
consumer - Consumer for the mappings
provideExternalMappings
public void provideExternalMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer,
int mappingType)
- Specified by:
provideExternalMappings in interface org.jpox.store.mapped.DatastoreClass
provideUnmappedDatastoreFields
public void provideUnmappedDatastoreFields(org.jpox.store.mapped.mapping.MappingConsumer consumer)
- Method to provide all unmapped datastore fields (columns) to the consumer.
- Specified by:
provideUnmappedDatastoreFields in interface org.jpox.store.mapped.DatastoreClass
- Parameters:
consumer - Consumer of information
getExternalMapping
public org.jpox.store.mapped.mapping.JavaTypeMapping getExternalMapping(org.jpox.metadata.AbstractMemberMetaData fmd,
int mappingType)
- Specified by:
getExternalMapping in interface org.jpox.store.mapped.DatastoreClass
getMetaDataForExternalMapping
public org.jpox.metadata.AbstractMemberMetaData getMetaDataForExternalMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
int mappingType)
- Specified by:
getMetaDataForExternalMapping in interface org.jpox.store.mapped.DatastoreClass
Copyright © -2008 . All Rights Reserved.