org.datanucleus.store.rdbms.scostore
Class RDBMSFKSetStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
      extended by org.datanucleus.store.mapped.scostore.ElementContainerStore
          extended by org.datanucleus.store.mapped.scostore.AbstractCollectionStore
              extended by org.datanucleus.store.mapped.scostore.AbstractSetStore
                  extended by org.datanucleus.store.mapped.scostore.FKSetStore
                      extended by org.datanucleus.store.rdbms.scostore.RDBMSFKSetStore
All Implemented Interfaces:
org.datanucleus.store.mapped.expression.CollectionStoreQueryable, org.datanucleus.store.scostore.CollectionStore, org.datanucleus.store.scostore.SetStore, org.datanucleus.store.scostore.Store

public class RDBMSFKSetStore
extends org.datanucleus.store.mapped.scostore.FKSetStore

RDBMS-specific implementation of an FKSetStore.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
org.datanucleus.store.mapped.scostore.ElementContainerStore.ElementInfo
 
Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, specialization
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsNull, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
RDBMSFKSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Constructor for the backing store of a FK set for RDBMS.
 
Method Summary
protected  void clearInternal(org.datanucleus.StateManager ownerSM, org.datanucleus.ObjectManager om)
           
protected  java.lang.String getClearNullifyStmt()
          Generates the statement for clearing items by nulling the owner link out.
protected  SQLStatement getSQLStatementForIterator(org.datanucleus.StateManager ownerSM)
          Method to generate an SQLStatement for iterating through elements of the set.
 java.util.Iterator iterator(org.datanucleus.StateManager ownerSM)
          Accessor for an iterator for the set.
protected  boolean updateElementFkInternal(org.datanucleus.StateManager sm, java.lang.Object element, java.lang.Object owner)
           
 
Methods inherited from class org.datanucleus.store.mapped.scostore.FKSetStore
add, addAll, checkRemovalOfElementShouldDelete, clear, getFieldNumberInElementForBidirectional, joinElementsTo, manageRemovalOfElement, remove, removeAll, update
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractCollectionStore
contains, getExistsSubquery, getSizeSubquery, updateEmbeddedElement
 
Methods inherited from class org.datanucleus.store.mapped.scostore.ElementContainerStore
getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getElementType, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, hasOrderMapping, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsBatching, getDatastoreAdapter, getOwnerMapping, getOwnerMemberMetaData, getRelationType, getStateManagerForEmbeddedPCObject, 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.scostore.CollectionStore
contains, getElementType, hasOrderMapping, size, updateEmbeddedElement
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Constructor Detail

RDBMSFKSetStore

public RDBMSFKSetStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                       RDBMSManager storeMgr,
                       org.datanucleus.ClassLoaderResolver clr)
Constructor for the backing store of a FK set for RDBMS.

Parameters:
mmd - The MetaData for the field that this represents
storeMgr - The MappedStoreManager managing the associated datastore.
clr - The ClassLoaderResolver
Method Detail

clearInternal

protected void clearInternal(org.datanucleus.StateManager ownerSM,
                             org.datanucleus.ObjectManager om)
Specified by:
clearInternal in class org.datanucleus.store.mapped.scostore.FKSetStore

getClearNullifyStmt

protected java.lang.String getClearNullifyStmt()
Generates the statement for clearing items by nulling the owner link out. The statement will be
 UPDATE LISTTABLE SET OWNERCOL=NULL [,DISTINGUISHER=NULL]
 WHERE OWNERCOL=?
 
when there is only one element table, and will be
 UPDATE ? SET OWNERCOL=NULL [,DISTINGUISHER=NULL]
 WHERE OWNERCOL=?
 
when there is more than 1 element table.

Returns:
The Statement for clearing items for the owner.

updateElementFkInternal

protected boolean updateElementFkInternal(org.datanucleus.StateManager sm,
                                          java.lang.Object element,
                                          java.lang.Object owner)
Specified by:
updateElementFkInternal in class org.datanucleus.store.mapped.scostore.FKSetStore

iterator

public java.util.Iterator iterator(org.datanucleus.StateManager ownerSM)
Accessor for an iterator for the set.

Specified by:
iterator in interface org.datanucleus.store.scostore.CollectionStore
Specified by:
iterator in class org.datanucleus.store.mapped.scostore.AbstractSetStore
Parameters:
ownerSM - State Manager for the set.
Returns:
Iterator for the set.

getSQLStatementForIterator

protected SQLStatement getSQLStatementForIterator(org.datanucleus.StateManager ownerSM)
Method to generate an SQLStatement for iterating through elements of the set. Selects the element table. Populates the iteratorMappingDef and iteratorMappingParams.

Parameters:
ownerSM - StateManager for the owner object
Returns:
The SQLStatement


Copyright © 2009. All Rights Reserved.