com.solarmetric.kodo.impl.jdbc.ormapping
Class CollectionMapping
java.lang.Object
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.Mapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.FieldMapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.AbstractCollectionMapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.CollectionMapping
- All Implemented Interfaces:
- LoadSecondary, SecondaryTable, StoreSecondary
- Direct Known Subclasses:
- OrderedCollectionMapping
- public class CollectionMapping
- extends AbstractCollectionMapping
- implements LoadSecondary, StoreSecondary, SecondaryTable
Represents a collection of simple values such as Integers, Strings, etc.
CollectionMappings are stored in a separate table from the primary values
of the owning class. Each row of the table holds two values: a single
element of the collection in the data column, and the PK value of the
owning object in the ref column.
|
Method Summary |
protected void |
addValueMatchCondition(SQLStatement sql,
Object value,
ClassResolver resolver)
Add a WHERE [data cols] = [value] for the given object value to
the given sql statement. |
protected boolean |
canMap(FieldMetaData fmd,
ClassResolver resolver)
Return true if this mapping type can handle the given field,
false otherwise. |
Table |
getSecondaryTable()
Return the secondary table used by this mapping. |
protected void |
insert(Insert insert,
Object value,
int index,
StateManagerImpl sm,
Object[] pks,
int field)
Prepare the insert for storage. |
protected void |
install(FieldMetaData fmd,
JDBCConfiguration conf,
ClassResolver resolver,
DBDictionary dict)
Setup this FieldMapping using the given metadata. |
void |
join(ObjectSelect sel)
Join this mapping to the given select statement. |
void |
joinRelation(Joins joins,
PersistenceManagerImpl pm)
Join this value's table to the table for the related first class object
type, if any. |
void |
load(StateManagerImpl sm,
Object[] pks,
int field,
SQLExecutionManager sqlem)
Load the value of this mapping for the given instance. |
protected void |
select(Select sel,
StateManagerImpl sm,
Object[] pks,
int field)
|
| Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.AbstractCollectionMapping |
appendIsEmpty, appendIsNotNull, appendIsNull, compareToNull, delete, fromArray, getInverse, getKeyColumns, getPKColumns, getRefColumns, insert, join, joinKey, joinKeyRelation, select, setPKColumns, setRefColumns, toArray, update |
| Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.Mapping |
checkExtension, createMapping, createMapping, createMappings, createMappings, getClassName, getConfiguration, getDictionary, getFieldMapping, getInstance, getTable, install |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionMapping
public CollectionMapping()
join
public void join(ObjectSelect sel)
- Description copied from class:
FieldMapping
- Join this mapping to the given select statement. For basic mappings,
this no-op method implementation will suffice. Secondary table
mappings should override this method to do the proper join.
- Overrides:
join in class FieldMapping
load
public void load(StateManagerImpl sm,
Object[] pks,
int field,
SQLExecutionManager sqlem)
throws SQLException
- Description copied from interface:
LoadSecondary
- Load the value of this mapping for the given instance.
Relations to other persistent types are loaded
as PersistenceCapable instances.
- Specified by:
load in interface LoadSecondary
- Following copied from interface:
com.solarmetric.kodo.impl.jdbc.ormapping.LoadSecondary
- Parameters:
stmnt - The caller is responsible for closing the statement.
select
protected void select(Select sel,
StateManagerImpl sm,
Object[] pks,
int field)
insert
protected void insert(Insert insert,
Object value,
int index,
StateManagerImpl sm,
Object[] pks,
int field)
- Description copied from class:
AbstractCollectionMapping
- Prepare the insert for storage. Throws exception by default.
- Overrides:
insert in class AbstractCollectionMapping
addValueMatchCondition
protected void addValueMatchCondition(SQLStatement sql,
Object value,
ClassResolver resolver)
- Description copied from class:
AbstractCollectionMapping
- Add a WHERE [data cols] = [value] for the given object value to
the given sql statement.
- Overrides:
addValueMatchCondition in class AbstractCollectionMapping
canMap
protected boolean canMap(FieldMetaData fmd,
ClassResolver resolver)
- Description copied from class:
FieldMapping
- Return true if this mapping type can handle the given field,
false otherwise. Note that this method cannot rely on the existance
of other Mappings, as it is used in bootstrapping.
- Overrides:
canMap in class AbstractCollectionMapping
install
protected void install(FieldMetaData fmd,
JDBCConfiguration conf,
ClassResolver resolver,
DBDictionary dict)
- Description copied from class:
FieldMapping
- Setup this FieldMapping using the given metadata. Note that this
method cannot rely on the existance of other Mappings, as it
it is used in bootstrapping. This base implementation installs
the proper extensions onto the metadata only; subclasses must override
to properly map the type.
- Overrides:
install in class AbstractCollectionMapping
getSecondaryTable
public Table getSecondaryTable()
- Description copied from interface:
SecondaryTable
- Return the secondary table used by this mapping.
- Specified by:
getSecondaryTable in interface SecondaryTable
joinRelation
public void joinRelation(Joins joins,
PersistenceManagerImpl pm)
- Description copied from class:
FieldMapping
- Join this value's table to the table for the related first class object
type, if any.
- Overrides:
joinRelation in class FieldMapping
Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.