SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.impl.jdbc.ormapping
Class OneToOneMapping

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.ormapping.Mapping
        |
        +--com.solarmetric.kodo.impl.jdbc.ormapping.FieldMapping
              |
              +--com.solarmetric.kodo.impl.jdbc.ormapping.OneToOneMapping
All Implemented Interfaces:
LoadPrimary, LoadSecondary, PrimaryTable, Relation, StorePrimary
Direct Known Subclasses:
InterfaceMapping

public class OneToOneMapping
extends FieldMapping
implements Relation, LoadPrimary, LoadSecondary, StorePrimary, PrimaryTable

Represents a 1-1 relation with a persistent object type, where the PK value of the related type is stored in the primary table of the owning class.


Fields inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.FieldMapping
COL_INDEX, COL_LENGTH, DATA_COL, EMPTY_COLUMNS
 
Fields inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.Mapping
_loc, _log, CUSTOM_MAPPING, dict, MAPPING, TABLE
 
Fields inherited from interface com.solarmetric.kodo.impl.jdbc.ormapping.Relation
INVERSE, READ_ONLY
 
Constructor Summary
OneToOneMapping()
           
 
Method Summary
 void appendIsEmpty(QuerySQLBuffer sql, Joins joins)
          Create a where clause to the given statement asking if this value is empty.
 void appendIsNotNull(QuerySQLBuffer sql, Joins joins)
          Add a where clause to the given statement asking if this value is not null.
 void appendIsNull(QuerySQLBuffer sql, Joins joins)
          Add a where clause to the given statement asking if this value is null.
protected  boolean canMap(FieldMetaData fmd, ClassResolver resolver)
          Return true if this mapping type can handle the given field, false otherwise.
 void delete(Delete del, StateManagerImpl sm, int field)
          Delete the field from the primary table for this mapping.
 Column[] getColumns()
          Return all columns of the primary table used only by this mapping.
 Object getDataStoreValue(Object val, PersistenceManagerImpl pm)
          Translate the given field value to its datastore equivalent.
(package private)  FieldMetaData getInverse(FieldMetaData fmd, ClassResolver resolver)
          Returns the metadata for the inverse extension of the given metadata, or null if it does not exist.
 Column[] getKeyColumns()
          Return the key columns of the mapping.
 Column[] getPKColumns()
          Return the primary key columns of the owning class.
 Column[] getRelationPKColumns()
          Return the primary key column(s) of the related object.
 Class getRelationType()
          Return the type the mapping relates to.
 void insert(Insert insert, StateManagerImpl sm, int field)
          Insert the given field into the primary table for this mapping.
protected  void install(FieldMetaData fmd, JDBCConfiguration conf, ClassResolver resolver, DBDictionary dict)
          Setup this FieldMapping using the given metadata.
protected  void installOneToOneMapping(FieldMetaData fmd, JDBCConfiguration conf, ClassResolver resolver, DBDictionary dict)
           
(package private)  boolean isInverse()
           
protected  boolean isValidInverse(FieldMetaData fmd, FieldMetaData imd)
          determine first if there is an inverse.
 void join(Joins joins, PersistenceManagerImpl pm)
          Join this value to the class table.
 void join(ObjectSelect sel)
          Join this mapping to the given select statement.
 void joinKey(Joins joins, PersistenceManagerImpl pm)
          Join the key value to the class table.
 void joinKeyRelation(Joins joins, PersistenceManagerImpl pm)
          Join this value's table to the table for the related first class object key type, if any.
 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, int field, ResultSet rs, int startColumn)
          Load the value of this mapping from the ResultSet produced by the Select passed to the select(com.solarmetric.kodo.impl.jdbc.sql.Select) method.
 void load(StateManagerImpl sm, Object[] pks, int field, SQLExecutionManager sqlem)
          Load the value of this mapping for the given instance.
 void select(QuerySelect sel)
          Select this mapping.
 void select(Select sel)
          Select the value of this mapping.
 void setPKColumns(Column[] val)
          Set the primary key columns of the owning class.
 void setRelationPKColumns(Column[] columns)
           
 void update(Update update, StateManagerImpl sm, int field)
          Update the given field into the primary table for this mapping.
 
Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.FieldMapping
addColumn, addPKColumns, compareToNull, getDataColumns, getInstance, getInstance, getKeyDataStoreValue, getMetaData, setDataColumns
 
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
 
Methods inherited from interface com.solarmetric.kodo.impl.jdbc.ormapping.Relation
getConfiguration
 

Constructor Detail

OneToOneMapping

public OneToOneMapping()
Method Detail

isInverse

boolean isInverse()

getPKColumns

public Column[] getPKColumns()
Return the primary key columns of the owning class.

setPKColumns

public void setPKColumns(Column[] val)
Set the primary key columns of the owning class.

getRelationType

public Class getRelationType()
Description copied from interface: Relation
Return the type the mapping relates to.
Specified by:
getRelationType in interface Relation

getRelationPKColumns

public Column[] getRelationPKColumns()
Description copied from interface: Relation
Return the primary key column(s) of the related object.
Specified by:
getRelationPKColumns in interface Relation

setRelationPKColumns

public void setRelationPKColumns(Column[] columns)

select

public void select(Select sel)
Description copied from interface: LoadPrimary
Select the value of this mapping.
Specified by:
select in interface LoadPrimary

load

public void load(StateManagerImpl sm,
                 int field,
                 ResultSet rs,
                 int startColumn)
          throws SQLException
Description copied from interface: LoadPrimary
Load the value of this mapping from the ResultSet produced by the Select passed to the LoadPrimary.select(com.solarmetric.kodo.impl.jdbc.sql.Select) method.
Specified by:
load in interface LoadPrimary

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.

insert

public void insert(Insert insert,
                   StateManagerImpl sm,
                   int field)
            throws SQLException
Description copied from interface: StorePrimary
Insert the given field into the primary table for this mapping.
Specified by:
insert in interface StorePrimary

update

public void update(Update update,
                   StateManagerImpl sm,
                   int field)
            throws SQLException
Description copied from interface: StorePrimary
Update the given field into the primary table for this mapping.
Specified by:
update in interface StorePrimary

delete

public void delete(Delete del,
                   StateManagerImpl sm,
                   int field)
            throws SQLException
Description copied from interface: StorePrimary
Delete the field from the primary table for this mapping.
Specified by:
delete in interface StorePrimary

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 FieldMapping

install

protected final 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 FieldMapping

installOneToOneMapping

protected void installOneToOneMapping(FieldMetaData fmd,
                                      JDBCConfiguration conf,
                                      ClassResolver resolver,
                                      DBDictionary dict)

isValidInverse

protected boolean isValidInverse(FieldMetaData fmd,
                                 FieldMetaData imd)
determine first if there is an inverse. If so, check for both sides having inverses, and test for read only

getInverse

FieldMetaData getInverse(FieldMetaData fmd,
                         ClassResolver resolver)
Returns the metadata for the inverse extension of the given metadata, or null if it does not exist. Should this be pushed up to FieldMapping.getInverse (FieldMetaData fmd, boolean isCollection) ? - skim

getColumns

public Column[] getColumns()
Description copied from interface: PrimaryTable
Return all columns of the primary table used only by this mapping.
Specified by:
getColumns in interface PrimaryTable

getDataStoreValue

public Object getDataStoreValue(Object val,
                                PersistenceManagerImpl pm)
Description copied from class: FieldMapping
Translate the given field value to its datastore equivalent. If the mapping occupies multiple columns in the datastore, return an object array, else return a single object. Simply returns the given object by default.
Overrides:
getDataStoreValue in class FieldMapping

select

public void select(QuerySelect sel)
Description copied from class: FieldMapping
Select this mapping.
Overrides:
select in class FieldMapping

getKeyColumns

public Column[] getKeyColumns()
Description copied from class: FieldMapping
Return the key columns of the mapping.
Overrides:
getKeyColumns in class FieldMapping

appendIsEmpty

public void appendIsEmpty(QuerySQLBuffer sql,
                          Joins joins)
Description copied from class: FieldMapping
Create a where clause to the given statement asking if this value is empty.
Overrides:
appendIsEmpty in class FieldMapping

appendIsNull

public void appendIsNull(QuerySQLBuffer sql,
                         Joins joins)
Description copied from class: FieldMapping
Add a where clause to the given statement asking if this value is null.
Overrides:
appendIsNull in class FieldMapping

appendIsNotNull

public void appendIsNotNull(QuerySQLBuffer sql,
                            Joins joins)
Description copied from class: FieldMapping
Add a where clause to the given statement asking if this value is not null.
Overrides:
appendIsNotNull in class FieldMapping

join

public void join(Joins joins,
                 PersistenceManagerImpl pm)
Description copied from class: FieldMapping
Join this value to the class table.
Overrides:
join in class FieldMapping

joinKey

public void joinKey(Joins joins,
                    PersistenceManagerImpl pm)
Description copied from class: FieldMapping
Join the key value to the class table.
Overrides:
joinKey in class FieldMapping

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

joinKeyRelation

public void joinKeyRelation(Joins joins,
                            PersistenceManagerImpl pm)
Description copied from class: FieldMapping
Join this value's table to the table for the related first class object key type, if any.
Overrides:
joinKeyRelation in class FieldMapping

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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