Class AbstractCollectionStore<E>
java.lang.Object
org.datanucleus.store.rdbms.scostore.BaseContainerStore
org.datanucleus.store.rdbms.scostore.ElementContainerStore
org.datanucleus.store.rdbms.scostore.AbstractCollectionStore<E>
- All Implemented Interfaces:
org.datanucleus.store.types.scostore.CollectionStore<E>
,org.datanucleus.store.types.scostore.Store
- Direct Known Subclasses:
AbstractListStore
,AbstractSetStore
,MapValueCollectionStore
public abstract class AbstractCollectionStore<E>
extends ElementContainerStore
implements org.datanucleus.store.types.scostore.CollectionStore<E>
Abstract representation of a store of a Collection.
Contains all common parts of storing Sets and Lists.
-
Field Summary
FieldsFields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCollectionStore
(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
private String
getContainsStatementString
(Object element) private String
getContainsStmt
(Object element) Generate statement for retrieving the contents of the Collection.private String
getRemoveStatementString
(Object element) protected String
getRemoveStmt
(Object element) Generate statement for removing an element from the Collection.protected String
getUpdateEmbeddedElementStmt
(JavaTypeMapping fieldMapping) Generate statement for update the field of an embedded element.void
update
(org.datanucleus.state.DNStateManager sm, Collection<? extends E> coll) boolean
updateEmbeddedElement
(org.datanucleus.state.DNStateManager sm, E element, int fieldNumber, Object value) Method to update a field of an embedded element.Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
clear, getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, iterator, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementType
Methods inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwner
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.datanucleus.store.types.scostore.CollectionStore
add, addAll, clear, hasOrderMapping, iterator, remove, removeAll, size
Methods inherited from interface org.datanucleus.store.types.scostore.Store
getOwnerMemberMetaData, getStoreManager
-
Field Details
-
containsStmt
-
-
Constructor Details
-
AbstractCollectionStore
protected AbstractCollectionStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr) Constructor.- Parameters:
storeMgr
- Manager for the storeclr
- ClassLoader resolver
-
-
Method Details
-
update
- Specified by:
update
in interfaceorg.datanucleus.store.types.scostore.CollectionStore<E>
-
contains
- Specified by:
contains
in interfaceorg.datanucleus.store.types.scostore.CollectionStore<E>
-
getContainsStmt
Generate statement for retrieving the contents of the Collection. The discriminator part is only present when the element type has inheritance strategy of "superclass-table" and is Inverse.SELECT OWNERCOL FROM COLLECTIONTABLE WHERE OWNERCOL=? AND ELEMENTCOL=? [AND DISCRIMINATOR=?] [AND RELATION_DISCRIM=?]
- Returns:
- Statement for retrieving the contents of the Collection.
-
getContainsStatementString
-
getRemoveStmt
Generate statement for removing an element from the Collection.DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ?
- Parameters:
element
- The element to remove- Returns:
- Statement for deleting an item from the Collection.
-
getRemoveStatementString
-
updateEmbeddedElement
public boolean updateEmbeddedElement(org.datanucleus.state.DNStateManager sm, E element, int fieldNumber, Object value) Method to update a field of an embedded element.- Specified by:
updateEmbeddedElement
in interfaceorg.datanucleus.store.types.scostore.CollectionStore<E>
- Parameters:
sm
- StateManager of the ownerelement
- The element to updatefieldNumber
- The number of the field to updatevalue
- The value- Returns:
- true if the datastore was updated
-
getUpdateEmbeddedElementStmt
Generate statement for update the field of an embedded element.UPDATE SETTABLE SET EMBEDDEDFIELD1 = ? WHERE OWNERCOL=? AND ELEMENTCOL = ?
- Parameters:
fieldMapping
- The mapping for the field within the embedded object to be updated- Returns:
- Statement for updating an embedded element in the Set
-