SolarMetric Kodo JDO 3.2.4 generated on January 7 2005

kodo.jdbc.meta
Interface ClassMapping

All Superinterfaces:
ClassMetaData, Comparable, Extensions, Mapping, com.solarmetric.meta.SourceTracker
All Known Implementing Classes:
AbstractClassMapping

public interface ClassMapping
extends ClassMetaData, Mapping

Mapping from a class to a relational schema.

In addition to the bean methods for simple metadata attributes, the following methods are available before ClassMetaData.resolve() has been called: isVirtualMapping(), getDeclaredFieldMapping(int), getDeclaredFieldMapping(String), getDeclaredFieldMappings(). If the superclass mapping has been set or if this is a base class, then getPrimaryKeyFieldMappings() and getPrimaryKeyColumns() are also available before resolve.


Field Summary
static String AUTO_INCREMENT
          Extension indicating that this data store identity class has an auto-incrementing primary key column.
static String CLASS_IND
          Extension key used to indicate the type of class indicator to use, or "none" for none.
static String CLASS_INDEXED
          Whether the class indicator is indexed.
static String CLASS_INDICATOR_VALUE
          Extension key used to specify the column class indicator value for this class.
static String CLASS_MAP
          Extension key used to indicate the type of class mapping to use.
static String[] EXTENSION_KEYS
          The list of all the recognized extension keys.
static String REF_DELETE_ACTION
          Extension key used to mark the foreign key delete action on vertically- mapped tables.
static String SEQUENCE_FACTORY
          Extension key used to indicate the sequence factory for this persistent type.
static String SEQUENCE_NAME
          The name of the sequence that we will use, in the case of a custom sequence factory that uses database sequences.
static String VERSION_IND
          Extension key used to indicate the type of version indicator to use, or "none" for none.
static String VERSION_INDEXED
          Whether the version indicator is indexed.
 
Fields inherited from interface kodo.meta.ClassMetaData
AUDITABLE, DATA_CACHE, DATA_CACHE_TIMEOUT, DETACH_FALSE, DETACH_OID_FIELD, DETACH_SERIALIZE, DETACH_STATE_FIELD, DETACH_TRUE, DETACHABLE, ID_APPLICATION, ID_DATASTORE, ID_NONDURABLE, SUBCLASS_FETCH_MODE, VALIDATE_ALL, VALIDATE_NONE, VALIDATE_NORESOLVE, VALIDATE_RUNTIME, VALIDATE_UNENHANCED
 
Method Summary
 ClassIndicator getClassIndicator()
          Return the class indicator for this class.
 int getClassIndicatorIndexed()
          The value of the class indicator indexed extension.
 String getClassIndicatorName()
          The value of the class indicator name extension.
 String getClassMappingName()
          The value of the class mapping name extension.
 Object getDataStoreValue(Object obj, Column[] cols)
          Return the given column value(s) for the given object.
 DBDictionary getDBDictionary()
          Return the dictionary that this mapping uses.
 FieldMapping getDeclaredFieldMapping(int index)
          Convenience method to make casting from ClassMetaData.getDeclaredField(int) unnecessary.
 FieldMapping getDeclaredFieldMapping(String name)
          Convenience method to make casting from ClassMetaData.getDeclaredField(int) unnecessary.
 FieldMapping[] getDeclaredFieldMappings()
          Convenience method to make casting from ClassMetaData.getDeclaredFields() unnecessary.
 FieldMapping[] getDefaultFetchGroupFieldMappings()
          Convenience method to make casting from ClassMetaData.getDefaultFetchGroupFields() unnecessary.
 FieldMapping getEmbeddingMapping()
          If this is an embedded mapping, return the owning field.
 FieldMapping getFieldMapping(FieldMetaData fmd)
          Return the field mapping for the specified metadata.
 FieldMapping getFieldMapping(int index)
          Convenience method to make casting from ClassMetaData.getField(int) unnecessary.
 FieldMapping getFieldMapping(String name)
          Convenience method to make casting from ClassMetaData.getField(int) unnecessary.
 FieldMapping[] getFieldMappings()
          Convenience method to make casting from ClassMetaData.getFields() unnecessary.
 JoinableMapping getJoinableMapping(Column col)
          Return the joinable mapping for the given column.
 FieldMapping[] getMappedFieldMappings()
          Returns an array of all the field mappings mapped by this class.
 ClassMappingInfo getMappingInfo()
          Return the mapping info that was used to create this mapping, if any.
 MappingRepository getMappingRepository()
          Return the mapping repository for this mapping.
 ClassMetaData getMetaData()
          Return the underlying class metadata.
 ClassMapping[] getNonVirtualMappings()
          Returns the closest-derived list of non-virtual mappings for this mapping.
 ClassMapping getNonVirtualPCSuperclassMapping()
          Return the nearest superclass mapping whose isVirtualMapping() method returns true will be skipped.
 Object getObjectId(JDBCStoreManager store, Result res, ForeignKey fk, Joins joins)
          Return the oid value stored in the result.
 ClassMapping[] getPCSubclassMappings()
          Return all the known subclass mappings for this mapping.
 ClassMapping getPCSuperclassMapping()
          Convenience method to make casting from ClassMetaData.getPCSuperclassMetaData() unnecessary.
 Column[] getPrimaryKeyColumns()
          Return the columns this mapping uses to uniquely identify an object.
 FieldMapping[] getPrimaryKeyFieldMappings()
          Convenience method to make casting from ClassMetaData.getPrimaryKeyFields() unnecessary.
 int getRefDeleteAction()
          The reference foreign key action.
 String getSequenceFactory()
          The value of the sequence factory extension.
 SequenceFactory getSequenceFactoryInstance()
          Return the sequence factory for this type, based on its sequence factory metadata extensions.
 VersionIndicator getVersionIndicator()
          Return the version indicator for this class.
 int getVersionIndicatorIndexed()
          The value of the version indicator indexed extension.
 String getVersionIndicatorName()
          The value of the version indicator name extension.
 boolean isAutoIncrement()
          True if this class uses an auto-increment datastore primary key.
 boolean isPrimaryKeyObjectId(boolean hasAll)
          Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values.
 boolean isRefDeleteActionDeferred()
          The reference foreign key action.
 boolean isVirtualMapping()
          Returns false if this mapping represents a table in the database.
 Joins joinSuperclass(Joins joins, boolean toThis)
          Join the mapping and its superclass.
 ResultObjectProvider load(JDBCStoreManager store, boolean subclasses, JDBCFetchConfiguration fetch, long startIdx, long endIdx)
          Override this method to customize obtaining a result containing all instances of this class.
 boolean load(KodoStateManager sm, JDBCStoreManager store, JDBCFetchConfiguration fetch, Result result)
          Override this method to customize loading a Result into an instance.
 boolean load(KodoStateManager sm, JDBCStoreManager store, JDOState state, JDBCFetchConfiguration fetch)
          Override this method to load the state of a given object, returning true if this method handles the load.
 void setAutoIncrement(boolean autoInc)
          True if this class uses an auto-increment datastore primary key.
 void setAutoIncrementValue(KodoStateManager sm, Column col, Connection conn)
          Set the next auto increment value for the given column into the given instance.
 void setClassIndicator(ClassIndicator cls)
          Set the class indicator for this class.
 void setClassIndicatorIndexed(int idx)
          The value of the class indicator indexed extension.
 void setClassIndicatorName(String ind)
          The value of the class indicator name extension.
 void setClassMappingName(String map)
          The value of the class mapping name extension.
 void setMappingInfo(ClassMappingInfo info)
          Set the mapping info that was used to create this class.
 void setPCSuperclassMapping(ClassMapping superMapping)
          Set the superclass mapping.
 void setRefDeleteAction(int action, boolean deferred)
          The reference foreign key action.
 void setRepository(JDOMetaDataRepository repos)
          The supplied repository must be a MappingRepository.
 void setSequenceFactory(String plugin)
          The value of the sequence factory extension.
 void setVersionIndicator(VersionIndicator version)
          Set the version indicator for this class.
 void setVersionIndicatorIndexed(int idx)
          The value of the version indicator indexed extension.
 void setVersionIndicatorName(String ind)
          The value of the version indicator name extension.
 boolean supportsEagerSelect(Select sel, KodoStateManager sm, ClassMapping base, JDBCStoreManager store, JDBCFetchConfiguration fetch)
          Return true if this mapping can perform the given select from the given base mapping.
 
Methods inherited from interface kodo.meta.ClassMetaData
addDeclaredField, getDataCache, getDataCacheName, getDataCacheTimeout, getDeclaredField, getDeclaredField, getDeclaredFields, getDeclaredUnmanagedFields, getDefaultFetchGroupFields, getDescribedType, getDetachable, getDetachObjectId, getDetachObjectIdField, getDetachState, getDetachStateField, getField, getField, getFields, getIdentityType, getObjectIdClass, getPCSubclasses, getPCSubclassMetaDatas, getPCSuperclass, getPCSuperclassMetaData, getPMClassLoader, getPrimaryKeyFields, getRepository, getRequiresExtent, getSourceFile, getSubclassFetchMode, getValidate, invalidateResolve, isEnhanced, isInstanceCallbacks, isMemberField, isResolved, removeDeclaredField, resolve, setDataCacheName, setDataCacheTimeout, setDescribedType, setDetachable, setDetachObjectId, setDetachState, setIdentityType, setObjectIdClass, setPCSuperclass, setPCSuperclassMetaData, setPMClassLoader, setRequiresExtent, setSourceFile, setSubclassFetchMode, setValidate
 
Methods inherited from interface kodo.meta.Extensions
addExtension, addExtension, addExtensionKeys, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface kodo.jdbc.meta.Mapping
addMappingInfoAttributes, delete, delete, fromMappingInfo, getMappingType, getTable, insert, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, refSchemaComponents, reverseMap, toMappingInfo, update, update
 

Field Detail

CLASS_MAP

public static final String CLASS_MAP
Extension key used to indicate the type of class mapping to use.

VERSION_IND

public static final String VERSION_IND
Extension key used to indicate the type of version indicator to use, or "none" for none.

CLASS_IND

public static final String CLASS_IND
Extension key used to indicate the type of class indicator to use, or "none" for none.

VERSION_INDEXED

public static final String VERSION_INDEXED
Whether the version indicator is indexed. Defaults to true.

CLASS_INDEXED

public static final String CLASS_INDEXED
Whether the class indicator is indexed. Defaults to true.

REF_DELETE_ACTION

public static final String REF_DELETE_ACTION
Extension key used to mark the foreign key delete action on vertically- mapped tables. Legal values are none, exception, exception-deferred, cascade, cascade-deferred. Defaults to none.

AUTO_INCREMENT

public static final String AUTO_INCREMENT
Extension indicating that this data store identity class has an auto-incrementing primary key column. For application identity, use this extension on the column's field. Legal values are true or false. Defaults to false.

SEQUENCE_FACTORY

public static final String SEQUENCE_FACTORY
Extension key used to indicate the sequence factory for this persistent type. This extension is only valid in least-derived persistent classes.

SEQUENCE_NAME

public static final String SEQUENCE_NAME
The name of the sequence that we will use, in the case of a custom sequence factory that uses database sequences.

CLASS_INDICATOR_VALUE

public static final String CLASS_INDICATOR_VALUE
Extension key used to specify the column class indicator value for this class.

EXTENSION_KEYS

public static final String[] EXTENSION_KEYS
The list of all the recognized extension keys.
Method Detail

getMappingRepository

public MappingRepository getMappingRepository()
Return the mapping repository for this mapping.
Specified by:
getMappingRepository in interface Mapping

getMappingInfo

public ClassMappingInfo getMappingInfo()
Return the mapping info that was used to create this mapping, if any.

setMappingInfo

public void setMappingInfo(ClassMappingInfo info)
Set the mapping info that was used to create this class.

getNonVirtualMappings

public ClassMapping[] getNonVirtualMappings()
Returns the closest-derived list of non-virtual mappings for this mapping. When isVirtualMapping() returns false, this method will simply return the current mapping.
Since:
3.1

getVersionIndicator

public VersionIndicator getVersionIndicator()
Return the version indicator for this class. Subclass mappings should delegate this method to their superclass.

setVersionIndicator

public void setVersionIndicator(VersionIndicator version)
Set the version indicator for this class. Subclass mappings should delegate this method to their superclass.

getClassIndicator

public ClassIndicator getClassIndicator()
Return the class indicator for this class. Subclass mappings should delegate this method to their superclass.

setClassIndicator

public void setClassIndicator(ClassIndicator cls)
Set the class indicator for this class. Subclass mappings should delegate this method to their superclass.

getEmbeddingMapping

public FieldMapping getEmbeddingMapping()
If this is an embedded mapping, return the owning field. Returns null by default.

getJoinableMapping

public JoinableMapping getJoinableMapping(Column col)
Return the joinable mapping for the given column. Any column that another mapping joins to must be controlled by a joinable mapping, unless it is a datastore identity column. This base class takes care of caching joinable mappings for all fields, and detecting requests for the datastore identity column. Class mappings that must link to their superclass table will usually have additional joinable mappings for the columns used for linking.

getPrimaryKeyColumns

public Column[] getPrimaryKeyColumns()
Return the columns this mapping uses to uniquely identify an object. These will typically be the primary key columns or the columns this class uses to link to its superclass table. This method must be available before resolve.

isPrimaryKeyObjectId

public boolean isPrimaryKeyObjectId(boolean hasAll)
Return true if the this class' primary key columns correspond to the base class' primary key columns used to construct oid values. Base classes always return true. Classes that join to the base class table, though, may not always join using the same columns the base class uses for oid values, or may not use all the columns. When performing a select, we will join down to the most-derived class that is identified by oid values. We cannot use non-primary key field values for joining during selects, because the field values to join on might be the ones we're trying to select! Similarly, we can only reconstruct oid values for selected object using classes whose primary keys store oid values.
Parameters:
hasAll - if true, there must be a primary key column for every base class primary key column; if false the primary key must only match a subset of the base class primary key columns

getObjectId

public Object getObjectId(JDBCStoreManager store,
                          Result res,
                          ForeignKey fk,
                          Joins joins)
                   throws SQLException
Return the oid value stored in the result. This implementation will recurse until it finds an ancestor class who uses oid values for its primary key.
Parameters:
fk - if non-null, use the local columns of the given foreign key in place of this class' primary key columns
See Also:
isPrimaryKeyObjectId(boolean)

setAutoIncrementValue

public void setAutoIncrementValue(KodoStateManager sm,
                                  Column col,
                                  Connection conn)
                           throws SQLException
Set the next auto increment value for the given column into the given instance.

getDataStoreValue

public Object getDataStoreValue(Object obj,
                                Column[] cols)
Return the given column value(s) for the given object. The given columns will be primary key columns of this mapping, but may be in any order. If there is only one column, return its value. If there are multiple columns, return an object array of their values, in the same order the columns are given.

joinSuperclass

public Joins joinSuperclass(Joins joins,
                            boolean toThis)
Join the mapping and its superclass.
Parameters:
toThis - if false, inner join to the superclass table; if true, outer join from the superclass table to this table

load

public ResultObjectProvider load(JDBCStoreManager store,
                                 boolean subclasses,
                                 JDBCFetchConfiguration fetch,
                                 long startIdx,
                                 long endIdx)
                          throws SQLException
Override this method to customize obtaining a result containing all instances of this class. Returns null by default.

load

public boolean load(KodoStateManager sm,
                    JDBCStoreManager store,
                    JDOState state,
                    JDBCFetchConfiguration fetch)
             throws SQLException,
                    ClassNotFoundException

Override this method to load the state of a given object, returning true if this method handles the load. If the object does not exist in the data store, simply take no action on it (but still return true). Returns false by default.

This method is invoked when Kodo has not performed any query against the database yet. This means that you must go to the database to fetch the needed data for this call. Contrast with load(KodoStateManager,JDBCStoreManager,JDBCFetchConfiguration,Result).

Parameters:
state - if non-null, then you must initialize the state and persistent object of the given state manager (after determining the actual class of the object from the database, if there are possible persistent subclasses); initialization looks like this: sm.initialize (ImplHelper.getJDOHelper ().newInstance (pcClass, sm, sm.getObjectId (false, false)), state); , where the ImplHelper class is in the kodo.util package

load

public boolean load(KodoStateManager sm,
                    JDBCStoreManager store,
                    JDBCFetchConfiguration fetch,
                    Result result)
             throws SQLException

Override this method to customize loading a Result into an instance. Return true if this mapping handles the load; false if normal loading should procede after calling this method. Returns false by default.

This method is invoked when Kodo needs to load a record and has already performed a query (via JDOQL, direct SQL, or via some other mechanism by which Kodo can perform bulk loads). You should attempt to load fields from result before performing any additional selects against the database.


supportsEagerSelect

public boolean supportsEagerSelect(Select sel,
                                   KodoStateManager sm,
                                   ClassMapping base,
                                   JDBCStoreManager store,
                                   JDBCFetchConfiguration fetch)
Return true if this mapping can perform the given select from the given base mapping. The given state manager may be null if selecting multiple instances. By default, returns true.

getClassMappingName

public String getClassMappingName()
The value of the class mapping name extension.

setClassMappingName

public void setClassMappingName(String map)
The value of the class mapping name extension.

getVersionIndicatorName

public String getVersionIndicatorName()
The value of the version indicator name extension.

setVersionIndicatorName

public void setVersionIndicatorName(String ind)
The value of the version indicator name extension.

getClassIndicatorName

public String getClassIndicatorName()
The value of the class indicator name extension.

setClassIndicatorName

public void setClassIndicatorName(String ind)
The value of the class indicator name extension.

getVersionIndicatorIndexed

public int getVersionIndicatorIndexed()
The value of the version indicator indexed extension.

setVersionIndicatorIndexed

public void setVersionIndicatorIndexed(int idx)
The value of the version indicator indexed extension.

getClassIndicatorIndexed

public int getClassIndicatorIndexed()
The value of the class indicator indexed extension.

setClassIndicatorIndexed

public void setClassIndicatorIndexed(int idx)
The value of the class indicator indexed extension.

getRefDeleteAction

public int getRefDeleteAction()
The reference foreign key action.

isRefDeleteActionDeferred

public boolean isRefDeleteActionDeferred()
The reference foreign key action.

setRefDeleteAction

public void setRefDeleteAction(int action,
                               boolean deferred)
The reference foreign key action.

getSequenceFactory

public String getSequenceFactory()
The value of the sequence factory extension.

setSequenceFactory

public void setSequenceFactory(String plugin)
The value of the sequence factory extension.

getSequenceFactoryInstance

public SequenceFactory getSequenceFactoryInstance()
Return the sequence factory for this type, based on its sequence factory metadata extensions. If no extensions are present in this type's least-derived persistent superclass, then the default sequence factory in the global configuration will be returned.

isAutoIncrement

public boolean isAutoIncrement()
True if this class uses an auto-increment datastore primary key.

setAutoIncrement

public void setAutoIncrement(boolean autoInc)
True if this class uses an auto-increment datastore primary key.

getMetaData

public ClassMetaData getMetaData()
Return the underlying class metadata.

setRepository

public void setRepository(JDOMetaDataRepository repos)
The supplied repository must be a MappingRepository.
Specified by:
setRepository in interface ClassMetaData

getPCSuperclassMapping

public ClassMapping getPCSuperclassMapping()
Convenience method to make casting from ClassMetaData.getPCSuperclassMetaData() unnecessary.

getNonVirtualPCSuperclassMapping

public ClassMapping getNonVirtualPCSuperclassMapping()
Return the nearest superclass mapping whose isVirtualMapping() method returns true will be skipped.

setPCSuperclassMapping

public void setPCSuperclassMapping(ClassMapping superMapping)
Set the superclass mapping. This is used before reading mappings from ClassMappingInfos.

getPCSubclassMappings

public ClassMapping[] getPCSubclassMappings()
Return all the known subclass mappings for this mapping.

getFieldMappings

public FieldMapping[] getFieldMappings()
Convenience method to make casting from ClassMetaData.getFields() unnecessary.

getDeclaredFieldMappings

public FieldMapping[] getDeclaredFieldMappings()
Convenience method to make casting from ClassMetaData.getDeclaredFields() unnecessary.

getPrimaryKeyFieldMappings

public FieldMapping[] getPrimaryKeyFieldMappings()
Convenience method to make casting from ClassMetaData.getPrimaryKeyFields() unnecessary.

getMappedFieldMappings

public FieldMapping[] getMappedFieldMappings()
Returns an array of all the field mappings mapped by this class. This includes non-virtual declared field mappings and any concrete mapping of virtual superclass fields performed by this class.

getDefaultFetchGroupFieldMappings

public FieldMapping[] getDefaultFetchGroupFieldMappings()
Convenience method to make casting from ClassMetaData.getDefaultFetchGroupFields() unnecessary.

getFieldMapping

public FieldMapping getFieldMapping(int index)
Convenience method to make casting from ClassMetaData.getField(int) unnecessary.

getDeclaredFieldMapping

public FieldMapping getDeclaredFieldMapping(int index)
Convenience method to make casting from ClassMetaData.getDeclaredField(int) unnecessary.

getFieldMapping

public FieldMapping getFieldMapping(String name)
Convenience method to make casting from ClassMetaData.getField(int) unnecessary.

getDeclaredFieldMapping

public FieldMapping getDeclaredFieldMapping(String name)
Convenience method to make casting from ClassMetaData.getDeclaredField(int) unnecessary.

getFieldMapping

public FieldMapping getFieldMapping(FieldMetaData fmd)
Return the field mapping for the specified metadata.

isVirtualMapping

public boolean isVirtualMapping()
Returns false if this mapping represents a table in the database.

getDBDictionary

public DBDictionary getDBDictionary()
Return the dictionary that this mapping uses.

SolarMetric Kodo JDO 3.2.4 generated on January 7 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.