public class FKSetStore<E> extends AbstractSetStore<E>
SetStore
using foreign keys.containsStmt
addStmt, clearStmt, containerTable, elementCmd, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt
allowNulls, clr, dba, ownerMapping, ownerMemberMetaData, relationType, storeMgr
Constructor and Description |
---|
FKSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr)
Constructor for the backing store of a FK set for RDBMS.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(org.datanucleus.state.ObjectProvider ownerOP,
E element,
int size)
Method to add an object to the relationship at the collection end.
|
boolean |
addAll(org.datanucleus.state.ObjectProvider ownerOP,
Collection<E> elements,
int size)
Method to add a collection of object to the relationship at the collection end.
|
protected boolean |
checkRemovalOfElementShouldDelete(org.datanucleus.state.ObjectProvider ownerOP)
Convenience method to return if the removal of an element should delete the element.
|
void |
clear(org.datanucleus.state.ObjectProvider ownerOP)
Method to allow the Set relationship to be cleared out.
|
protected String |
getClearNullifyStmt(ComponentInfo info)
Generates the statement for clearing items by nulling the owner link out.
|
protected int |
getFieldNumberInElementForBidirectional(org.datanucleus.state.ObjectProvider op)
This seems to return the field number in the element of the relation when it is a bidirectional relation.
|
ElementIteratorStatement |
getIteratorStatement(org.datanucleus.ExecutionContext ec,
org.datanucleus.FetchPlan fp,
boolean addRestrictionOnOwner)
Method to return the SQLStatement and mapping for an iterator for this backing store.
|
Iterator<E> |
iterator(org.datanucleus.state.ObjectProvider ownerOP)
Accessor for an iterator for the set.
|
protected void |
manageRemovalOfElement(org.datanucleus.state.ObjectProvider ownerOP,
Object element)
Convenience method to manage the removal of an element from the collection, performing
any necessary "managed relationship" updates when the field is bidirectional.
|
boolean |
remove(org.datanucleus.state.ObjectProvider ownerOP,
Object element,
int size,
boolean allowDependentField)
Method to remove the link to the collection object specified.
|
boolean |
removeAll(org.datanucleus.state.ObjectProvider ownerOP,
Collection elements,
int size)
Method to remove the links to a collection of elements specified.
|
void |
update(org.datanucleus.state.ObjectProvider ownerOP,
Collection coll)
Method to update the collection to be the supplied collection of elements.
|
contains, getRemoveStmt, getUpdateEmbeddedElementStmt, updateEmbeddedElement, updateEmbeddedElement
getAddStmtForJoinTable, getClearStmt, getComponentInfoForElement, getContainerTable, getElementClassMetaData, getElementMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, usingJoinTable, validateElementForReading, validateElementForWriting, validateElementType
allowsBatching, getComponentInformationForClass, getDatastoreAdapter, getObjectProviderForEmbeddedPCObject, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStoreManager, isEmbeddedMapping, setOwner
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FKSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
mmd
- The MetaData for the field that this representsstoreMgr
- The StoreManager managing the associated datastore.clr
- The ClassLoaderResolverprotected int getFieldNumberInElementForBidirectional(org.datanucleus.state.ObjectProvider op)
op
- ObjectProvider for the owner.public void update(org.datanucleus.state.ObjectProvider ownerOP, Collection coll)
update
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
update
in class AbstractCollectionStore<E>
ownerOP
- ObjectProvider for the owner.coll
- The collection to usepublic boolean add(org.datanucleus.state.ObjectProvider ownerOP, E element, int size)
ownerOP
- ObjectProvider for the owner.element
- Element to be addedpublic boolean addAll(org.datanucleus.state.ObjectProvider ownerOP, Collection<E> elements, int size)
ownerOP
- ObjectProvider for the owner.elements
- Elements to be addedpublic boolean remove(org.datanucleus.state.ObjectProvider ownerOP, Object element, int size, boolean allowDependentField)
remove
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
remove
in class AbstractSetStore<E>
ownerOP
- ObjectProvider for the owner.element
- The element of the collection to be deleted.allowDependentField
- Whether to allow any cascade deletes caused by this removalsize
- Current sizepublic boolean removeAll(org.datanucleus.state.ObjectProvider ownerOP, Collection elements, int size)
removeAll
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
removeAll
in class AbstractSetStore<E>
ownerOP
- ObjectProvider for the owner.elements
- The elements of the collection to be deleted.protected boolean checkRemovalOfElementShouldDelete(org.datanucleus.state.ObjectProvider ownerOP)
ownerOP
- ObjectProvider for the owner.protected void manageRemovalOfElement(org.datanucleus.state.ObjectProvider ownerOP, Object element)
ownerOP
- ObjectProvider for the owner.element
- The elementpublic void clear(org.datanucleus.state.ObjectProvider ownerOP)
clear
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
clear
in class ElementContainerStore
ownerOP
- ObjectProvider for the owner.protected String getClearNullifyStmt(ComponentInfo info)
UPDATE LISTTABLE SET OWNERCOL=NULL [,DISTINGUISHER=NULL] WHERE OWNERCOL=?
info
- ElementInfo for the elementpublic Iterator<E> iterator(org.datanucleus.state.ObjectProvider ownerOP)
iterator
in interface org.datanucleus.store.types.scostore.CollectionStore<E>
iterator
in class AbstractSetStore<E>
ownerOP
- ObjectProvider for the owner.public ElementIteratorStatement getIteratorStatement(org.datanucleus.ExecutionContext ec, org.datanucleus.FetchPlan fp, boolean addRestrictionOnOwner)
SELECT ELEM_COLS FROM ELEM_TBL [WHERE] [ELEM_TBL.OWNER_ID = {value}] [AND] [ELEM_TBL.DISCRIM = {discrimValue}] [ORDER BY {orderClause}]
ec
- ExecutionContextfp
- FetchPlan to use in determining which fields of element to selectaddRestrictionOnOwner
- Whether to restrict to a particular owner (otherwise functions as bulk fetch for many owners).Copyright © 2019. All rights reserved.