org.datanucleus.store.rdbms.scostore
Class RDBMSJoinMapStore

java.lang.Object
  extended by org.datanucleus.store.mapped.scostore.BaseContainerStore
      extended by org.datanucleus.store.mapped.scostore.AbstractMapStore
          extended by org.datanucleus.store.mapped.scostore.JoinMapStore
              extended by org.datanucleus.store.rdbms.scostore.RDBMSJoinMapStore
All Implemented Interfaces:
org.datanucleus.store.mapped.expression.MapStoreQueryable, org.datanucleus.store.scostore.MapStore, org.datanucleus.store.scostore.Store

public class RDBMSJoinMapStore
extends org.datanucleus.store.mapped.scostore.JoinMapStore

RDBMS-specific implementation of an JoinMapStore.


Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.scostore.JoinMapStore
adapterMapping, clr
 
Fields inherited from class org.datanucleus.store.mapped.scostore.AbstractMapStore
iterateUsingDiscriminator, keyMapping, keysAreEmbedded, keysAreSerialised, keyType, kmd, mapTable, specialization, valueMapping, valuesAreEmbedded, valuesAreSerialised, valueTable, valueType, vmd
 
Fields inherited from class org.datanucleus.store.mapped.scostore.BaseContainerStore
allowsNull, dba, LOCALISER, ownerMapping, ownerMemberMetaData, relationType, storeMgr
 
Constructor Summary
RDBMSJoinMapStore(MapTable mapTable, org.datanucleus.ClassLoaderResolver clr)
          Constructor for the backing store of a join map for RDBMS.
 
Method Summary
protected  void clearInternal(org.datanucleus.StateManager ownerSM)
           
protected  SQLStatement getSQLStatementForGet(org.datanucleus.StateManager ownerSM)
          Method to return an SQLStatement for retrieving the value for a key.
protected  java.lang.Object getValue(org.datanucleus.StateManager ownerSM, java.lang.Object key)
          Method to retrieve a value from the Map given the key.
protected  int[] internalPut(org.datanucleus.StateManager ownerSM, org.datanucleus.ManagedConnection conn, boolean batched, java.lang.Object key, java.lang.Object value, boolean executeNow)
          Method to process a "put" statement (where the key has no value in the join table).
protected  void internalUpdate(org.datanucleus.StateManager ownerSM, org.datanucleus.ManagedConnection conn, boolean batched, java.lang.Object key, java.lang.Object value, boolean executeNow)
          Method to process an "update" statement (where the key already has a value in the join table).
protected  org.datanucleus.store.mapped.scostore.MapEntrySetStore newMapEntrySetStore()
           
protected  org.datanucleus.store.mapped.scostore.MapKeySetStore newMapKeySetStore()
           
protected  org.datanucleus.store.mapped.scostore.MapValueSetStore newMapValueSetStore()
           
protected  void removeInternal(org.datanucleus.StateManager sm, java.lang.Object key)
           
 
Methods inherited from class org.datanucleus.store.mapped.scostore.JoinMapStore
clear, entrySetStore, getAdapterMapping, joinKeysTo, joinKeysValuesTo, joinValuesTo, keySetStore, put, putAll, remove, valueSetStore
 
Methods inherited from class org.datanucleus.store.mapped.scostore.AbstractMapStore
containsKey, containsValue, get, getExistsSubquery, getKeyMapping, getKeyType, getKmd, getMapTable, getSizeSubquery, getValueMapping, getValueType, getVmd, isValuesAreEmbedded, isValuesAreSerialised, joinKeysToGet, keysAreEmbedded, keysAreSerialised, updateEmbeddedKey, updateEmbeddedValue, validateKeyForReading, validateKeyForWriting, validateKeyType, validateValueForReading, validateValueForWriting, validateValueType, valuesAreEmbedded, valuesAreSerialised
 
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
 

Constructor Detail

RDBMSJoinMapStore

public RDBMSJoinMapStore(MapTable mapTable,
                         org.datanucleus.ClassLoaderResolver clr)
Constructor for the backing store of a join map for RDBMS.

Parameters:
mapTable - Join table for the Map
clr - The ClassLoaderResolver
Method Detail

getValue

protected java.lang.Object getValue(org.datanucleus.StateManager ownerSM,
                                    java.lang.Object key)
                             throws java.util.NoSuchElementException
Method to retrieve a value from the Map given the key.

Specified by:
getValue in class org.datanucleus.store.mapped.scostore.AbstractMapStore
Parameters:
ownerSM - State Manager for the owner of the map.
key - The key to retrieve the value for.
Returns:
The value for this key
Throws:
java.util.NoSuchElementException - if the value for the key was not found

getSQLStatementForGet

protected SQLStatement getSQLStatementForGet(org.datanucleus.StateManager ownerSM)
Method to return an SQLStatement for retrieving the value for a key. Selects the join table and optionally joins to the value table if it has its own table.

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

clearInternal

protected void clearInternal(org.datanucleus.StateManager ownerSM)
Specified by:
clearInternal in class org.datanucleus.store.mapped.scostore.JoinMapStore

removeInternal

protected void removeInternal(org.datanucleus.StateManager sm,
                              java.lang.Object key)
Specified by:
removeInternal in class org.datanucleus.store.mapped.scostore.JoinMapStore

newMapKeySetStore

protected org.datanucleus.store.mapped.scostore.MapKeySetStore newMapKeySetStore()
Specified by:
newMapKeySetStore in class org.datanucleus.store.mapped.scostore.JoinMapStore

newMapValueSetStore

protected org.datanucleus.store.mapped.scostore.MapValueSetStore newMapValueSetStore()
Specified by:
newMapValueSetStore in class org.datanucleus.store.mapped.scostore.JoinMapStore

newMapEntrySetStore

protected org.datanucleus.store.mapped.scostore.MapEntrySetStore newMapEntrySetStore()
Specified by:
newMapEntrySetStore in class org.datanucleus.store.mapped.scostore.JoinMapStore

internalUpdate

protected void internalUpdate(org.datanucleus.StateManager ownerSM,
                              org.datanucleus.ManagedConnection conn,
                              boolean batched,
                              java.lang.Object key,
                              java.lang.Object value,
                              boolean executeNow)
                       throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Method to process an "update" statement (where the key already has a value in the join table).

Specified by:
internalUpdate in class org.datanucleus.store.mapped.scostore.JoinMapStore
Parameters:
ownerSM - StateManager for the owner
conn - The Connection
batched - Whether we are batching it
key - The key
value - The new value
executeNow - Whether to execute the statement now or wait til any batch
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException - Thrown if an error occurs

internalPut

protected int[] internalPut(org.datanucleus.StateManager ownerSM,
                            org.datanucleus.ManagedConnection conn,
                            boolean batched,
                            java.lang.Object key,
                            java.lang.Object value,
                            boolean executeNow)
                     throws org.datanucleus.store.mapped.exceptions.MappedDatastoreException
Method to process a "put" statement (where the key has no value in the join table).

Specified by:
internalPut in class org.datanucleus.store.mapped.scostore.JoinMapStore
Parameters:
ownerSM - StateManager for the owner
conn - The Connection
batched - Whether we are batching it
key - The key
value - The value
executeNow - Whether to execute the statement now or wait til batching
Returns:
The return codes from any executed statement
Throws:
org.datanucleus.store.mapped.exceptions.MappedDatastoreException - Thrown if an error occurs


Copyright © 2009. All Rights Reserved.