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:
- DatastoreClass, DatastoreContainerObject, DatastoreObject, Table
- public class SecondaryTable
- extends AbstractClassTable
- implements DatastoreClass
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.29 $
Methods inherited from class org.jpox.store.rdbms.table.AbstractClassTable |
addFieldMapping, getDataStoreObjectIdMapping, getDefaultNameForType, getDiscriminatorMapping, getVersionMapping, managesField, provideDatastoreIdMappings, provideDiscriminatorMappings, provideMappingsForFields, provideNonPrimaryKeyMappings, provideVersionMappings |
Methods inherited from class org.jpox.store.rdbms.table.TableImpl |
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, allowDdlDump, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreIdentifierFullyQualified, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isDumpingDdl, isInitialized, isInitializedModified, isPKInitialized, isValidated, setDdlDumpWriter, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
preInitialize
public void preInitialize(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(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(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(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.
getPrimaryDatastoreContainerObject
public DatastoreContainerObject getPrimaryDatastoreContainerObject()
- Accessor for the primary table associated with this table
- Overrides:
getPrimaryDatastoreContainerObject
in class AbstractClassTable
- Returns:
- The associated primary table
getIdentityType
public IdentityType getIdentityType()
- Accessor for the identity-type.
Simply returns the same as the primary table
- Specified by:
getIdentityType
in interface 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 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 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 DatastoreClass
- Returns:
- true if this table is a root table
getBaseDatastoreClassWithField
public DatastoreClass getBaseDatastoreClassWithField(AbstractPropertyMetaData fmd)
- Convenience accessor for the base table for this table which has the specified field.
- Specified by:
getBaseDatastoreClassWithField
in interface DatastoreClass
- Parameters:
fmd
- Field MetaData for this field
- Returns:
- The base table which has the field specified
insert
public void insert(StateManager sm)
- Method to insert an object for this class.
Will insert any superclass records as well (recursive).
- Specified by:
insert
in interface DatastoreClass
- Parameters:
sm
- StateManager for the object to insert.
fetch
public void fetch(StateManager sm,
AbstractPropertyMetaData[] fieldMetaData)
- Method to fetch an object for this class.
Will fetch any superclass records as well (recursive).
- Specified by:
fetch
in interface DatastoreClass
- Parameters:
sm
- StateManager for the object to fetch.fieldMetaData
- MetaData for the fields to be fetched
update
public void update(StateManager sm,
AbstractPropertyMetaData[] fieldMetaData)
- Method to update an object for this class.
Will update any superclass records as well (recursive).
- Specified by:
update
in interface DatastoreClass
- Parameters:
sm
- StateManager for the object to update.fieldMetaData
- MetaData for the fields to be updated
delete
public void delete(StateManager sm)
- Method to delete an object for this class.
Will delete any superclass records as well (recursive).
- Specified by:
delete
in interface DatastoreClass
- Parameters:
sm
- StateManager for the object to delete.
locate
public void locate(StateManager sm)
- Locates this object in the datastore.
- Specified by:
locate
in interface DatastoreClass
- Parameters:
sm
- The StateManager for the object to be found
- Throws:
javax.jdo.JDOObjectNotFoundException
- If the instance does not exist in
the datastore
deleteDependent
public void deleteDependent(StateManager sm,
AbstractPropertyMetaData[] fields)
- Method to delete all dependent objects.
Not used here since a secondary table has no such dependents
- Specified by:
deleteDependent
in interface DatastoreClass
- Parameters:
sm
- The State Managerfields
- MetaData for the fields
getExpectedForeignKeys
protected java.util.List getExpectedForeignKeys()
- Accessor for the expected foreign keys for this table.
- Returns:
- The expected foreign keys.
getFieldMapping
public JavaTypeMapping getFieldMapping(AbstractPropertyMetaData fmd)
- Accessor for the field Mapping.
Returns the mapping if it is present in this table.
- Specified by:
getFieldMapping
in interface DatastoreClass
- Parameters:
fmd
- Field MetaData for this field
- Returns:
- the Mapping for the field
getFieldMapping
public JavaTypeMapping getFieldMapping(java.lang.String fieldName)
- Accessor for the field mapping for the specified field.
- Specified by:
getFieldMapping
in interface DatastoreClass
- Parameters:
fieldName
- Name of the field
- Returns:
- The mapping for the field
getFieldMetaData
public AbstractPropertyMetaData getFieldMetaData(java.lang.String fieldName)
- Accessor for the field metadata for the specified field name.
- Specified by:
getFieldMetaData
in interface DatastoreClass
- Parameters:
fieldName
- Name of the field
- Returns:
- FieldMetaData for the field
getIDMapping
public JavaTypeMapping getIDMapping()
- Accessor for the ID mapping for this table.
- Specified by:
getIDMapping
in interface DatastoreContainerObject
- Returns:
- The ID mapping
providePrimaryKeyMappings
public void providePrimaryKeyMappings(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 DatastoreClass
- Specified by:
providePrimaryKeyMappings
in class AbstractClassTable
- Parameters:
consumer
- Consumer for the mappings
provideExternalFkMappings
public void provideExternalFkMappings(MappingConsumer consumer)
- Description copied from interface:
DatastoreClass
- Provide the mappings to external FK mappings
- Specified by:
provideExternalFkMappings
in interface DatastoreClass
- Parameters:
consumer
- Consumer for the mappings
provideExternalOrderMappings
public void provideExternalOrderMappings(MappingConsumer consumer)
- Description copied from interface:
DatastoreClass
- Provide the mappings to external order mappings
- Specified by:
provideExternalOrderMappings
in interface DatastoreClass
- Parameters:
consumer
- Consumer for the mappings
newOID
public java.lang.Object newOID(PersistenceManager sm,
javax.jdo.spi.PersistenceCapable pcClass)
- Description copied from interface:
DatastoreClass
- Create a new OID.
OID can be datastore identity or application identity
- Specified by:
newOID
in interface DatastoreClass
- Parameters:
sm
- The PersistenceManagerpcClass
- The Persistence-Capable class
- Returns:
- New OID
getExternalOrderMapping
public JavaTypeMapping getExternalOrderMapping(AbstractPropertyMetaData fmd)
- Description copied from interface:
DatastoreClass
- Accessor for the external order mapping specified by the field.
- Specified by:
getExternalOrderMapping
in interface DatastoreClass
- Parameters:
fmd
- The metadata for the List field.
- Returns:
- The index mapping for the specified field.
getExternalFkDiscriminatorMapping
public JavaTypeMapping getExternalFkDiscriminatorMapping(AbstractPropertyMetaData fmd)
- Description copied from interface:
DatastoreClass
- Accessor for the external FK discriminator mapping for an owner field.
- Specified by:
getExternalFkDiscriminatorMapping
in interface DatastoreClass
- Parameters:
fmd
- The metadata for the field.
- Returns:
- The external mapping for the specified field.
getExternalFkMapping
public JavaTypeMapping getExternalFkMapping(AbstractPropertyMetaData fmd)
- Description copied from interface:
DatastoreClass
- Accessor for the external FK mapping for an owner field.
- Specified by:
getExternalFkMapping
in interface DatastoreClass
- Parameters:
fmd
- The metadata for the field.
- Returns:
- The external mapping for the specified field.
Copyright © -2007 . All Rights Reserved.