Class FKArrayStore<E>

  • All Implemented Interfaces:
    org.datanucleus.store.types.scostore.ArrayStore<E>, org.datanucleus.store.types.scostore.Store

    public class FKArrayStore<E>
    extends AbstractArrayStore<E>
    Implementation of an FK ArrayStore.
    • Constructor Detail

      • FKArrayStore

        public FKArrayStore​(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.state.DNStateManager 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.types.scostore.ArrayStore<E>
        Overrides:
        clear in class AbstractArrayStore<E>
        Parameters:
        ownerSM - StateManager
      • 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.state.DNStateManager ownerSM,
                           Object array)
        Description copied from class: AbstractArrayStore
        Method to set the array for the specified owner to the passed value.
        Specified by:
        set in interface org.datanucleus.store.types.scostore.ArrayStore<E>
        Overrides:
        set in class AbstractArrayStore<E>
        Parameters:
        ownerSM - StateManager for the owner
        array - the array
        Returns:
        Whether the array was updated successfully
      • iterator

        public Iterator<E> iterator​(org.datanucleus.state.DNStateManager ownerSM)
        Description copied from class: AbstractArrayStore
        Accessor for an iterator through the array elements.
        Specified by:
        iterator in interface org.datanucleus.store.types.scostore.ArrayStore<E>
        Specified by:
        iterator in class AbstractArrayStore<E>
        Parameters:
        ownerSM - StateManager for the container.
        Returns:
        The Iterator
      • getIteratorStatement

        public 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. Create a statement of the form
         SELECT ELEM_COLS
         FROM ELEM_TBL
         [WHERE]
           [ELEM_TBL.OWNER_ID = {value}] [AND]
           [ELEM_TBL.DISCRIM = {discrimValue}]
         [ORDER BY {orderClause}]
         
        Parameters:
        ec - ExecutionContext
        fp - FetchPlan to use in determing which fields of element to select
        addRestrictionOnOwner - Whether to restrict to a particular owner (otherwise functions as bulk fetch for many owners).
        Returns:
        The SQLStatement and its associated StatementClassMapping