Class MapKeySetStore<K>
java.lang.Object
org.datanucleus.store.rdbms.scostore.BaseContainerStore
org.datanucleus.store.rdbms.scostore.ElementContainerStore
org.datanucleus.store.rdbms.scostore.AbstractCollectionStore<K>
org.datanucleus.store.rdbms.scostore.AbstractSetStore<K>
org.datanucleus.store.rdbms.scostore.MapKeySetStore<K>
- All Implemented Interfaces:
org.datanucleus.store.types.scostore.CollectionStore<K>, org.datanucleus.store.types.scostore.SetStore<K>, org.datanucleus.store.types.scostore.Store
Implementation of a backing SetStore for map keys.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StatementClassMappingprivate StatementParameterMappingprivate StringJDBC statement to use for retrieving keys of the map (locking).private StringJDBC statement to use for retrieving keys of the map (not locking).protected final org.datanucleus.store.types.scostore.MapStore<K, ?> Backing store for the map.Fields inherited from class AbstractCollectionStore
containsStmtFields inherited from class ElementContainerStore
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmtFields inherited from class BaseContainerStore
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr -
Constructor Summary
ConstructorsConstructorDescriptionMapKeySetStore(DatastoreClass mapTable, FKMapStore<K, ?> mapStore, org.datanucleus.ClassLoaderResolver clr) Constructor where a foreign key is used to store the map relation.MapKeySetStore(MapTable mapTable, JoinMapStore<K, ?> mapStore, org.datanucleus.ClassLoaderResolver clr) Constructor where a join table is used to store the map relation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(org.datanucleus.state.DNStateManager sm, Collection keys, int size) voidclear(org.datanucleus.state.DNStateManager sm) Clear the association from owner to all elements.protected SelectStatementgetSQLStatementForIterator(org.datanucleus.state.DNStateManager ownerSM) Method to generate an SQLStatement for iterating through keys of the map.private voidinitialize(org.datanucleus.ClassLoaderResolver clr) Initialisation method.iterator(org.datanucleus.state.DNStateManager ownerSM) Accessor for an iterator for the set.booleanbooleanremoveAll(org.datanucleus.state.DNStateManager sm, Collection keys, int size) Methods inherited from class AbstractCollectionStore
contains, getRemoveStmt, getUpdateEmbeddedElementStmt, update, updateEmbeddedElementMethods inherited from class ElementContainerStore
getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementTypeMethods inherited from class BaseContainerStore
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, getStoreManager, isEmbeddedMapping, setOwnerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.datanucleus.store.types.scostore.CollectionStore
contains, hasOrderMapping, size, update, updateEmbeddedElementMethods inherited from interface org.datanucleus.store.types.scostore.Store
getOwnerMemberMetaData, getStoreManager
-
Field Details
-
mapStore
Backing store for the map. -
iteratorStmtLocked
JDBC statement to use for retrieving keys of the map (locking). -
iteratorStmtUnlocked
JDBC statement to use for retrieving keys of the map (not locking). -
iteratorMappingDef
-
iteratorMappingParams
-
-
Constructor Details
-
MapKeySetStore
MapKeySetStore(MapTable mapTable, JoinMapStore<K, ?> mapStore, org.datanucleus.ClassLoaderResolver clr) Constructor where a join table is used to store the map relation.- Parameters:
mapTable- Join table used by the map (join table)mapStore- Backing store for the mapclr- The ClassLoaderResolver
-
MapKeySetStore
MapKeySetStore(DatastoreClass mapTable, FKMapStore<K, ?> mapStore, org.datanucleus.ClassLoaderResolver clr) Constructor where a foreign key is used to store the map relation.- Parameters:
mapTable- Table holding the map relation (key or value)mapStore- Backing store for the mapclr- The ClassLoaderResolver
-
-
Method Details
-
initialize
private void initialize(org.datanucleus.ClassLoaderResolver clr) Initialisation method. -
add
-
addAll
-
remove
public boolean remove(org.datanucleus.state.DNStateManager sm, Object key, int size, boolean allowDependentField) - Specified by:
removein interfaceorg.datanucleus.store.types.scostore.CollectionStore<K>- Overrides:
removein classAbstractSetStore<K>
-
removeAll
-
clear
public void clear(org.datanucleus.state.DNStateManager sm) Description copied from class:ElementContainerStoreClear the association from owner to all elements. Provides cascade-delete when the elements being deleted are PC types.- Specified by:
clearin interfaceorg.datanucleus.store.types.scostore.CollectionStore<K>- Overrides:
clearin classElementContainerStore- Parameters:
sm- StateManager for the container.
-
iterator
Accessor for an iterator for the set.- Specified by:
iteratorin interfaceorg.datanucleus.store.types.scostore.CollectionStore<K>- Specified by:
iteratorin classAbstractSetStore<K>- Parameters:
ownerSM- StateManager for the set.- Returns:
- Iterator for the set.
-
getSQLStatementForIterator
Method to generate an SQLStatement for iterating through keys of the map. Populates the iteratorMappingDef and iteratorMappingParams. Creates a statement that selects the key table(s), and adds any necessary join to the containerTable if that is not the key table. If the key is embedded then selects the table it is embedded in. Adds a restriction on the ownerMapping of the containerTable so we can restrict to the owner object.- Parameters:
ownerSM- StateManager for the owner object- Returns:
- The SQLStatement
-