org.datanucleus.store.rdbms.scostore
Class RDBMSFKArrayStore

java.lang.Object
  extended by org.datanucleus.store.rdbms.scostore.BaseContainerStore
      extended by org.datanucleus.store.rdbms.scostore.ElementContainerStore
          extended by org.datanucleus.store.rdbms.scostore.AbstractArrayStore
              extended by org.datanucleus.store.rdbms.scostore.RDBMSFKArrayStore
All Implemented Interfaces:
org.datanucleus.store.scostore.ArrayStore, org.datanucleus.store.scostore.Store

public class RDBMSFKArrayStore
extends AbstractArrayStore

RDBMS-specific implementation of an FK ArrayStore.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, sizeStmt, usingDiscriminatorInSizeStmt
 
Fields inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowNulls, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
RDBMSFKArrayStore(org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
           
 
Method Summary
 void clear(org.datanucleus.store.ObjectProvider ownerSM)
          Method to clear the Array.
protected  String getClearNullifyStmt()
          Generates the statement for clearing items by nulling the owner link out.
protected  SQLStatement getSQLStatementForIterator(org.datanucleus.store.ObjectProvider ownerSM)
          Method to generate an SQLStatement for iterating through elements of the set.
 Iterator iterator(org.datanucleus.store.ObjectProvider ownerSM)
          Accessor for an iterator for the set.
 boolean set(org.datanucleus.store.ObjectProvider ownerSM, Object array)
          Method to set the array for the specified owner to the passed value.
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.AbstractArrayStore
add, clearInternal, getArray, internalAdd, processBatchedWrites
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.ElementContainerStore
executeClear, getAddStmt, getClearStmt, getContainerTable, getElementInfo, getElementInformationForClass, getElementMapping, getEmd, getOrderMapping, getRelationDiscriminatorMapping, getRelationDiscriminatorValue, getSize, getSizeStmt, hasOrderMapping, invalidateAddStmt, isElementsAreEmbedded, isElementsAreSerialised, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class org.datanucleus.store.rdbms.scostore.BaseContainerStore
allowsBatching, 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.scostore.ArrayStore
size
 
Methods inherited from interface org.datanucleus.store.scostore.Store
getStoreManager
 

Constructor Detail

RDBMSFKArrayStore

public RDBMSFKArrayStore(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                         RDBMSStoreManager storeMgr,
                         org.datanucleus.ClassLoaderResolver clr)
Parameters:
mmd - Metadata for the owning field/property
storeMgr - Manager for the datastore
clr - ClassLoader resolver
Method Detail

clear

public void clear(org.datanucleus.store.ObjectProvider ownerSM)
Method to clear the Array. This is called when the container object is being deleted and the elements are to be removed (maybe for dependent field).

Specified by:
clear in interface org.datanucleus.store.scostore.ArrayStore
Overrides:
clear in class AbstractArrayStore
Parameters:
ownerSM - The state manager

getClearNullifyStmt

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

Returns:
The Statement for clearing items for the owner.

set

public boolean set(org.datanucleus.store.ObjectProvider ownerSM,
                   Object array)
Method to set the array for the specified owner to the passed value.

Specified by:
set in interface org.datanucleus.store.scostore.ArrayStore
Overrides:
set in class AbstractArrayStore
Parameters:
ownerSM - State Manager for the owner
array - the array
Returns:
Whether the array was updated successfully

iterator

public Iterator iterator(org.datanucleus.store.ObjectProvider ownerSM)
Accessor for an iterator for the set.

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

getSQLStatementForIterator

protected SQLStatement getSQLStatementForIterator(org.datanucleus.store.ObjectProvider 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 © 2012. All Rights Reserved.