org.datanucleus.store.mapped.scostore
Class AbstractCollectionStore
java.lang.Object
org.datanucleus.store.mapped.scostore.BaseContainerStore
org.datanucleus.store.mapped.scostore.ElementContainerStore
org.datanucleus.store.mapped.scostore.AbstractCollectionStore
- All Implemented Interfaces:
- CollectionStoreQueryable, CollectionStore, Store
- Direct Known Subclasses:
- AbstractListStore, AbstractSetStore
public abstract class AbstractCollectionStore
- extends ElementContainerStore
- implements CollectionStore, CollectionStoreQueryable
Abstract representation of a store of a Collection.
Contains all common parts of storing Sets and Lists.
| Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore |
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization |
|
Method Summary |
boolean |
contains(StateManager sm,
java.lang.Object element)
Method to verify if the association owner vs elements contains
a specific element in the association |
QueryExpression |
getExistsSubquery(QueryExpression qs,
JavaTypeMapping mapping,
LogicSetExpression ownerTe,
DatastoreIdentifier collectionTableAlias)
Query utility to generate an exists() statement for an element. |
QueryExpression |
getSizeSubquery(QueryExpression qs,
JavaTypeMapping mapping,
LogicSetExpression ownerTe,
DatastoreIdentifier collectionTableAlias)
Query utility to generate a subquery for the size() of the collection. |
void |
update(StateManager sm,
java.util.Collection coll)
Method to update the collection to be the supplied collection of elements. |
boolean |
updateEmbeddedElement(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 org.datanucleus.store.mapped.scostore.ElementContainerStore |
clear, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, iterator, size, validateElementForReading, validateElementForWriting, validateElementType |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractCollectionStore
protected AbstractCollectionStore(StoreManager storeMgr,
ClassLoaderResolver clr,
AbstractCollectionStoreSpecialization abstractCollectionStoreSpecialization)
- Constructor.
- Parameters:
storeMgr - Manager for the storeclr - ClassLoader resolver
updateEmbeddedElement
public boolean updateEmbeddedElement(StateManager sm,
java.lang.Object element,
int fieldNumber,
java.lang.Object value)
- Method to update a field of an embedded element.
- Specified by:
updateEmbeddedElement in interface CollectionStore
- Parameters:
sm - State Manager of the ownerelement - The element to updatefieldNumber - The number of the field to updatevalue - The value
- Returns:
- true if the datastore was updated
update
public void update(StateManager sm,
java.util.Collection coll)
- Method to update the collection to be the supplied collection of elements.
- Specified by:
update in interface CollectionStore
- Parameters:
sm - StateManager of the objectcoll - The collection to use
contains
public boolean contains(StateManager sm,
java.lang.Object element)
- Method to verify if the association owner vs elements contains
a specific element in the association
- Specified by:
contains in interface CollectionStore
- Parameters:
sm - The StateManagerelement - The element
- Returns:
- Whether it contains the element
getExistsSubquery
public QueryExpression getExistsSubquery(QueryExpression qs,
JavaTypeMapping mapping,
LogicSetExpression ownerTe,
DatastoreIdentifier collectionTableAlias)
- Query utility to generate an exists() statement for an element.
The generated query will be of the form
SELECT 1 FROM JOINTABLE THIS_JOIN WHERE THIS_JOIN.OWNER_ID_OID = THIS.OWNER_ID
- Specified by:
getExistsSubquery in interface CollectionStoreQueryable
- Parameters:
qs - 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
- Returns:
- The query statement
getSizeSubquery
public QueryExpression getSizeSubquery(QueryExpression qs,
JavaTypeMapping mapping,
LogicSetExpression ownerTe,
DatastoreIdentifier collectionTableAlias)
- Query utility to generate a subquery for the size() of the collection.
The generated query will be of the form
SELECT COUNT(*) FROM JOINTABLE THIS_JOIN WHERE THIS_JOIN.OWNER_ID_OID = THIS.OWNER_ID
- Specified by:
getSizeSubquery in interface CollectionStoreQueryable
- Parameters:
qs - 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
- Returns:
- The query statement
Copyright © 2010. All Rights Reserved.