|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.store.rdbms.scostore.ElementContainerStore
org.jpox.store.rdbms.scostore.AbstractCollectionStore
public abstract class AbstractCollectionStore
Abstract representation of a store of a Collection. Contains all common parts of storing Sets and Lists.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
|---|
ElementContainerStore.ElementInfo |
| Field Summary | |
|---|---|
protected boolean |
allowsNull
Whether the container allows null elements/values. |
protected java.lang.String |
containsStmt
Statement for getting whether an element is contained in the collection. |
protected org.jpox.store.mapped.DatastoreAdapter |
dba
Datastore adapter in use by this store. |
protected static org.jpox.util.Localiser |
LOCALISER
Localiser for messages. |
protected org.jpox.store.mapped.mapping.JavaTypeMapping |
ownerMapping
Mapping to the owner of the container. |
protected org.jpox.metadata.AbstractMemberMetaData |
ownerMemberMetaData
MetaData for the field/property in the owner with this container. |
protected RDBMSManager |
storeMgr
Manager for the store. |
| Fields inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore |
|---|
addStmt, clearStmt, clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, elmIdentifier, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, usingDiscriminatorInSizeStmt |
| Constructor Summary | |
|---|---|
protected |
AbstractCollectionStore(org.jpox.store.StoreManager storeMgr,
org.jpox.ClassLoaderResolver clr)
Constructor. |
| Method Summary | |
|---|---|
protected boolean |
allowsBatching()
Convenience method to return if the RDBMS supports batching and the user wants batching. |
boolean |
contains(org.jpox.StateManager sm,
java.lang.Object element)
Method to verify if the association owner vs elements contains a specific element in the association |
protected java.lang.String |
getContainsStmt()
Generate statement for retrieving the contents of the Collection. |
org.jpox.store.mapped.expression.QueryExpression |
getExistsSubquery(org.jpox.store.mapped.expression.QueryExpression qs,
org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
org.jpox.store.mapped.expression.LogicSetExpression ownerTe,
org.jpox.store.mapped.DatastoreIdentifier collectionTableAlias)
Query utility to generate an exists() statement for an element. |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getOwnerMapping()
Accessor for the owner mapping. |
protected java.lang.String |
getRemoveStmt()
Generate statement for removing an element from the Collection. |
org.jpox.store.mapped.expression.QueryExpression |
getSizeSubquery(org.jpox.store.mapped.expression.QueryExpression qs,
org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
org.jpox.store.mapped.expression.LogicSetExpression ownerTe,
org.jpox.store.mapped.DatastoreIdentifier collectionTableAlias)
Query utility to generate a subquery for the size() of the collection. |
protected org.jpox.StateManager |
getStateManagerForEmbeddedPCObject(org.jpox.StateManager sm,
java.lang.Object obj,
JoinTable table)
Method to return the StateManager for an embedded PC object (element, key, value). |
org.jpox.store.StoreManager |
getStoreManager()
Accessor for the RDBMSManager. |
protected java.lang.String |
getUpdateEmbeddedElementStmt(org.jpox.store.mapped.mapping.JavaTypeMapping fieldMapping)
Generate statement for update the field of an embedded element. |
protected int[] |
internalRemove(org.jpox.StateManager ownerSM,
org.jpox.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow)
Method to process a "remove" statement |
protected boolean |
isEmbeddedMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping)
Check if the mapping correspond to a non pc object or embedded field |
protected int |
populateOwnerInStatement(org.jpox.StateManager sm,
org.jpox.ObjectManager om,
java.sql.PreparedStatement ps,
int jdbcPosition)
Convenience method to populate the passed PreparedStatement with the value from the owner. |
protected void |
setOwnerMemberMetaData(org.jpox.metadata.AbstractMemberMetaData mmd)
Method to set the owner field/property MetaData and sets whether null elements/values are allowed. |
boolean |
updateEmbeddedElement(org.jpox.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value)
Method to update a field of an embedded element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jpox.store.scostore.CollectionStore |
|---|
add, addAll, clear, getElementType, hasOrderMapping, iterator, remove, removeAll, size |
| Methods inherited from interface org.jpox.store.scostore.Store |
|---|
getStoreManager |
| Methods inherited from interface org.jpox.store.mapped.scostore.CollectionStoreQueryable |
|---|
joinElementsTo, newQueryStatement, newResultObjectFactory |
| Field Detail |
|---|
protected java.lang.String containsStmt
protected static final org.jpox.util.Localiser LOCALISER
protected RDBMSManager storeMgr
protected org.jpox.store.mapped.DatastoreAdapter dba
protected org.jpox.store.mapped.mapping.JavaTypeMapping ownerMapping
protected org.jpox.metadata.AbstractMemberMetaData ownerMemberMetaData
protected boolean allowsNull
| Constructor Detail |
|---|
protected AbstractCollectionStore(org.jpox.store.StoreManager storeMgr,
org.jpox.ClassLoaderResolver clr)
storeMgr - Manager for the storeclr - ClassLoader resolver| Method Detail |
|---|
protected java.lang.String getUpdateEmbeddedElementStmt(org.jpox.store.mapped.mapping.JavaTypeMapping fieldMapping)
UPDATE SETTABLE SET EMBEDDEDFIELD1 = ? WHERE OWNERCOL=? AND ELEMENTCOL = ?
fieldMapping - The mapping for the field within the embedded object to be updated
public boolean updateEmbeddedElement(org.jpox.StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value)
updateEmbeddedElement in interface org.jpox.store.scostore.CollectionStoresm - State Manager of the ownerelement - The element to updatefieldNumber - The number of the field to updatevalue - The value
protected java.lang.String getContainsStmt()
SELECT OWNERCOL FROM COLLECTIONTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND DISCRIMINATOR=?] [AND RELATION_DISCRIM=?]
public boolean contains(org.jpox.StateManager sm,
java.lang.Object element)
contains in interface org.jpox.store.scostore.CollectionStoresm - The StateManagerelement - The element
protected int[] internalRemove(org.jpox.StateManager ownerSM,
org.jpox.ManagedConnection conn,
boolean batched,
java.lang.Object element,
boolean executeNow)
throws java.sql.SQLException
ownerSM - StateManager for the ownerconn - The connectionbatched - Whether we are batching itelement - The elementexecuteNow - Whether to execute the statement rather than allow batching til later
java.sql.SQLException - Thrown if an error occursprotected java.lang.String getRemoveStmt()
DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ? [AND DISCRIM = ?]
public org.jpox.store.mapped.expression.QueryExpression getExistsSubquery(org.jpox.store.mapped.expression.QueryExpression qs,
org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
org.jpox.store.mapped.expression.LogicSetExpression ownerTe,
org.jpox.store.mapped.DatastoreIdentifier collectionTableAlias)
SELECT 1 FROM JOINTABLE THIS_JOIN WHERE THIS_JOIN.OWNER_ID_OID = THIS.OWNER_ID
getExistsSubquery in interface org.jpox.store.mapped.scostore.CollectionStoreQueryableqs - The parent query statement that will use this as a subquerymapping - mapping for the ownerownerTe - Expression for the table that the subquery should join tocollectionTableAlias - alias for the main table of the subquery
public org.jpox.store.mapped.expression.QueryExpression getSizeSubquery(org.jpox.store.mapped.expression.QueryExpression qs,
org.jpox.store.mapped.mapping.JavaTypeMapping mapping,
org.jpox.store.mapped.expression.LogicSetExpression ownerTe,
org.jpox.store.mapped.DatastoreIdentifier collectionTableAlias)
SELECT COUNT(*) FROM JOINTABLE THIS_JOIN WHERE THIS_JOIN.OWNER_ID_OID = THIS.OWNER_ID
getSizeSubquery in interface org.jpox.store.mapped.scostore.CollectionStoreQueryableqs - The parent query statement that will use this as a subquerymapping - mapping of the fieldownerTe - Expression for the owner table that the subquery should join tocollectionTableAlias - alias for the main table of the subquery
protected void setOwnerMemberMetaData(org.jpox.metadata.AbstractMemberMetaData mmd)
mmd - MetaData for the field/property owning this backing store.public org.jpox.store.StoreManager getStoreManager()
public org.jpox.store.mapped.mapping.JavaTypeMapping getOwnerMapping()
protected boolean isEmbeddedMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping)
mapping - the mapping
protected int populateOwnerInStatement(org.jpox.StateManager sm,
org.jpox.ObjectManager om,
java.sql.PreparedStatement ps,
int jdbcPosition)
sm - State Managerom - Object Managerps - The PreparedStatementjdbcPosition - Position in JDBC statement to populate
protected org.jpox.StateManager getStateManagerForEmbeddedPCObject(org.jpox.StateManager sm,
java.lang.Object obj,
JoinTable table)
sm - State Manager of the ownerobj - The embedded PC objecttable - Join table where the objects are stored
protected boolean allowsBatching()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||