#include <orMappingStrategy.h>
Public Types | |
enum | ColSource { COLSOURCE_ATTR = 0, COLSOURCE_INHERITEDPK, COLSOURCE_INHERITED, COLSOURCE_FILTERED } |
Classifies the attributes in the getMappedAttributes() list. More... | |
Public Member Functions | |
virtual void | init () |
Validates the associated persistent object. | |
virtual void | postInit () |
Second phase of the initialization routine. | |
virtual void | loadOne (Connection &conn, DatabaseObject *obj, const KeyValues &keyVals, bool wait, bool lock) |
Loads attributes declared in the associated type from its associated mapping table or type. | |
virtual OidObject * | viewLoadAll (Connection &conn, const OidType &oid, bool wait, bool lock) |
Loads all attributes from the associated types' simple view. | |
virtual void | updateOne (Connection &conn, DatabaseObject &obj) |
Updates columns from attributes declared in the associated type in its associated mapping table or ADT type instance. | |
virtual void | deleteOne (Connection &conn, const OidType &oid) |
Deletes an OidObject identified by OID from the associated table ord deletes the associated ADT type instance. | |
virtual void | deleteOne (Connection &conn, const KeyValues &keyVals) |
Deletes an OidObject identified by @ KeyValues from the associated table or deletes the associated ADT type instance. | |
virtual void | insertOne (Connection &conn, DatabaseObject &obj) |
Inserts values of attributes declared in the associated type to associated table or creates a new associated ADT type instance. | |
virtual DbType & | getDbType () const |
Returns the associated DbType instance. | |
virtual const Type & | getType () const |
Returns the associated Type instance. | |
const MappedAttributesList & | getMappedAttributes () const |
Returns a list of attributes that are physically mapped into table associated with getType(). | |
bool | hasDbTable () const |
Returns true if the type has a database table associated (false for filtered mapping, true for other mapping types). | |
DbType & | getInsertToType () const |
Returns destination type for filtered-mapping classes. |
Classifies the attributes in the getMappedAttributes() list.
COLSOURCE_ATTR | Persistent attributes of the current class. (PersistentAttributes). |
COLSOURCE_INHERITEDPK | Inherited KeyAttributes - even if the class does not employ horizontal mapping. |
COLSOURCE_INHERITED | If the current class uses horizontal mapping, the list includes non-key inherited persistent attributes from the InheritedAttributes list. Attributes inherited from the OidObject are excluded as the Oid - classname catalogue (a table associated with OidObject) is accessed even when using horizontal mapping. |
COLSOURCE_FILTERED | Persistent attributes from classes that use filtered mapping - persistent attributes from classes in the FilteredTypes list. |
void ORMappingStrategy::init | ( | ) | [virtual] |
Validates the associated persistent object.
Checks all mapping-related metadata and pre-generates lists of mapped attributes or other data it needs during the mapping algorithm execution.
Implements iopc::MappingStrategy.
void ORMappingStrategy::postInit | ( | ) | [virtual] |
Second phase of the initialization routine.
Executed after all strategies and DbType-s have finished the first phase (DbPtr::init(), MappingStrategy::init())
Implements iopc::MappingStrategy.
void ORMappingStrategy::loadOne | ( | Connection & | conn, | |
DatabaseObject * | obj, | |||
const KeyValues & | keyVals, | |||
bool | wait, | |||
bool | lock | |||
) | [virtual] |
Loads attributes declared in the associated type from its associated mapping table or type.
conn | Connection from which to load the attributes | |
obj | Object whose attributes will be loaded from conn | |
keyVals | Identifies the object whose attributes to load | |
wait | Specifies whether the operation should wait for database locks to be unlocked. | |
lock | Specifies whether the persistent copy should be locked in DB exlusively when loaded. |
Implements iopc::MappingStrategy.
OidObject * ORMappingStrategy::viewLoadAll | ( | Connection & | conn, | |
const OidType & | oid, | |||
bool | wait, | |||
bool | lock | |||
) | [virtual] |
Loads all attributes from the associated types' simple view.
conn | Connection from which to load the attributes | |
oid | OID of the object to be laoded | |
wait | Specifies whether the operation should wait for database locks to be unlocked. | |
lock | Specifies whether the persistent copy should be locked in DB exlusively when loaded. |
Implements iopc::MappingStrategy.
void ORMappingStrategy::updateOne | ( | Connection & | conn, | |
DatabaseObject & | obj | |||
) | [virtual] |
Updates columns from attributes declared in the associated type in its associated mapping table or ADT type instance.
conn | Connection used to update the values | |
obj | Obj containing attributes that update the database values |
Implements iopc::MappingStrategy.
void ORMappingStrategy::deleteOne | ( | Connection & | conn, | |
const OidType & | oid | |||
) | [virtual] |
Deletes an OidObject identified by OID from the associated table ord deletes the associated ADT type instance.
conn | Connection used to delete the object | |
oid | OID of the object to delete |
Implements iopc::MappingStrategy.
void ORMappingStrategy::deleteOne | ( | Connection & | conn, | |
const KeyValues & | keyVals | |||
) | [virtual] |
Deletes an OidObject identified by @ KeyValues from the associated table or deletes the associated ADT type instance.
conn | Connection used to delete the object | |
keyVals | KeyValues of the object to delete |
Implements iopc::MappingStrategy.
void ORMappingStrategy::insertOne | ( | Connection & | conn, | |
DatabaseObject & | obj | |||
) | [virtual] |
Inserts values of attributes declared in the associated type to associated table or creates a new associated ADT type instance.
conn | Connection used to perform the operation | |
obj | Object containing the values to insert. |
Implements iopc::MappingStrategy.
const MappedAttributesList& iopc::ORMappingStrategy::getMappedAttributes | ( | ) | const [inline] |
Returns a list of attributes that are physically mapped into table associated with getType().
In fact they represent columns of this table. The list may include attributes from other classes. Attributes are categorized by their origin:
DbType& iopc::ORMappingStrategy::getInsertToType | ( | ) | const [inline] |
Returns destination type for filtered-mapping classes.
For other mapping types, behaviour of this method is undefined.