|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.mapping.JavaTypeMapping
org.jpox.store.mapping.SingleFieldMapping
org.jpox.store.mapping.AbstractContainerMapping
Mapping for a field that represents a container of objects, such as a List, a Set, a Collection, a Map, or an array. Has an owner table. Can be represented in the following ways :-
Field Summary | |
protected Store |
contentsStore
Store for the contents. |
protected DatastoreObject |
contentsTable
Datastore class of the contents. |
protected java.lang.String |
fieldName
Name of the field that is the container. |
protected java.lang.Class |
instantiatedType
The type of the instantiated object in this field. |
protected StoreManager |
storeMgr
Store Manager being used. |
Fields inherited from class org.jpox.store.mapping.SingleFieldMapping |
datastoreContainer, typeInfo |
Fields inherited from class org.jpox.store.mapping.JavaTypeMapping |
datastoreMappings, dba, fmd, LOCALISER, referenceMapping, type |
Constructor Summary | |
AbstractContainerMapping(DatastoreAdapter dba,
AbstractPropertyMetaData fmd,
DatastoreContainerObject datastoreContainer,
ClassLoaderResolver clr)
Constructor. |
|
AbstractContainerMapping(DatastoreAdapter dba,
java.lang.String type)
Constructor taking the database adapter representing the datastore being used and the class of the mapping. |
Method Summary | |
protected boolean |
containerIsStoredInSingleColumn()
Convenience method to return if the container (collection or map) is stored in the owning table as a column. |
DatastoreContainerObject |
getDatastoreContainer()
Accessor for the datastore class. |
DatastoreMapping |
getDataStoreMapping(int index)
Accessor for a datastore mapping |
DatastoreMapping[] |
getDataStoreMappings()
Accessor for the datastore mappings for this java type |
int |
getNumberOfDatastoreFields()
Accessor for the number of datastore fields |
java.lang.Object |
getObject(PersistenceManager pm,
java.lang.Object resultSet,
int[] exprIndex)
Method to retrieve an object from the passed JDBC ResultSet. |
java.lang.Object |
getSampleValue()
Accessor for a sample value for this mapping. |
int |
hashCode()
Hash code function. |
boolean |
includeInFetchStatement()
This mapping is included in the select statement. |
boolean |
includeInInsertStatement()
This mapping is included in the insert statement. |
boolean |
includeInUpdateStatement()
This mapping is included in the update statement. |
protected java.lang.Object |
newWrapper(StateManager ownerSM,
java.lang.String fieldName)
Method to return a SCO wrapper for this container. |
void |
postFetch(StateManager sm)
Method to be called after any fetch of the owner class element. |
protected void |
prepareDatastoreMapping()
Method to prepare a field mapping for use in the datastore. |
void |
setObject(PersistenceManager pm,
java.lang.Object preparedStatement,
int[] exprIndex,
java.lang.Object value)
Method to set a field in the passed JDBC PreparedStatement using this mapping. |
protected void |
validateElementForWriting(StateManager sm,
java.lang.Object element)
Method to check if an element is already persistent, or is managed by a different Persistencemanager. |
protected void |
validateElementsForWriting(StateManager sm,
java.lang.Object elements)
Method to check if an element is already persistent, or is managed by a different Persistencemanager. |
Methods inherited from class org.jpox.store.mapping.SingleFieldMapping |
equals, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getShort, getString, hasValue, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString |
Methods inherited from class org.jpox.store.mapping.JavaTypeMapping |
addDataStoreMapping, failureMessage, getFieldMetaData, getJavaType, getObject, getReferenceMapping, getType, isNullable, newLiteral, newScalarExpression, setDefault, setObject, setReferenceMapping |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.lang.String fieldName
protected final StoreManager storeMgr
protected DatastoreObject contentsTable
protected Store contentsStore
protected java.lang.Class instantiatedType
Constructor Detail |
public AbstractContainerMapping(DatastoreAdapter dba, java.lang.String type)
dba
- Database adaptertype
- Java class being mapped to the DBpublic AbstractContainerMapping(DatastoreAdapter dba, AbstractPropertyMetaData fmd, DatastoreContainerObject datastoreContainer, ClassLoaderResolver clr)
dba
- Datastore adapterfmd
- Field metadata for the fielddatastoreContainer
- The owner tableclr
- The ClassLoaderResolverMethod Detail |
protected void prepareDatastoreMapping()
prepareDatastoreMapping
in class SingleFieldMapping
public void setObject(PersistenceManager pm, java.lang.Object preparedStatement, int[] exprIndex, java.lang.Object value)
setObject
in class SingleFieldMapping
pm
- The Persistence ManagerpreparedStatement
- The JDBC Prepared Statement to be populatedexprIndex
- The parameter positions in the JDBC statement to populate.value
- The value to populate into itpublic java.lang.Object getObject(PersistenceManager pm, java.lang.Object resultSet, int[] exprIndex)
getObject
in class SingleFieldMapping
pm
- Persistence ManagerresultSet
- The JDBC ResultSetexprIndex
- The JDBC parameter position(s) to extract the object from
public DatastoreContainerObject getDatastoreContainer()
getDatastoreContainer
in class SingleFieldMapping
public int getNumberOfDatastoreFields()
getNumberOfDatastoreFields
in class JavaTypeMapping
public DatastoreMapping getDataStoreMapping(int index)
getDataStoreMapping
in class JavaTypeMapping
index
- The id of the mapping
public DatastoreMapping[] getDataStoreMappings()
getDataStoreMappings
in class JavaTypeMapping
protected boolean containerIsStoredInSingleColumn()
public boolean includeInFetchStatement()
includeInFetchStatement
in class SingleFieldMapping
public boolean includeInUpdateStatement()
includeInUpdateStatement
in class SingleFieldMapping
public boolean includeInInsertStatement()
includeInInsertStatement
in class SingleFieldMapping
public int hashCode()
public java.lang.Object getSampleValue()
getSampleValue
in class JavaTypeMapping
protected java.lang.Object newWrapper(StateManager ownerSM, java.lang.String fieldName)
ownerSM
- State Manager for the owning bjectfieldName
- The field name
public void postFetch(StateManager sm)
sm
- StateManager of the ownerprotected void validateElementForWriting(StateManager sm, java.lang.Object element)
sm
- The state manager of this ownerelement
- The elementprotected void validateElementsForWriting(StateManager sm, java.lang.Object elements)
sm
- The state manager of this ownerelements
- The elements
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |