Class AbstractCollectionStore<E>

All Implemented Interfaces:
org.datanucleus.store.types.scostore.CollectionStore<E>, org.datanucleus.store.types.scostore.Store
Direct Known Subclasses:
AbstractListStore, AbstractSetStore, MapValueCollectionStore

public abstract class AbstractCollectionStore<E> extends ElementContainerStore implements org.datanucleus.store.types.scostore.CollectionStore<E>
Abstract representation of a store of a Collection. Contains all common parts of storing Sets and Lists.
  • Field Details

    • containsStmt

      protected String containsStmt
  • Constructor Details

    • AbstractCollectionStore

      protected AbstractCollectionStore(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
      Constructor.
      Parameters:
      storeMgr - Manager for the store
      clr - ClassLoader resolver
  • Method Details

    • update

      public void update(org.datanucleus.state.DNStateManager sm, Collection<? extends E> coll)
      Specified by:
      update in interface org.datanucleus.store.types.scostore.CollectionStore<E>
    • contains

      public boolean contains(org.datanucleus.state.DNStateManager sm, Object element)
      Specified by:
      contains in interface org.datanucleus.store.types.scostore.CollectionStore<E>
    • getContainsStmt

      private String getContainsStmt(Object element)
      Generate statement for retrieving the contents of the Collection. The discriminator part is only present when the element type has inheritance strategy of "superclass-table" and is Inverse.
       SELECT OWNERCOL FROM COLLECTIONTABLE
       WHERE OWNERCOL=?
       AND ELEMENTCOL=?
       [AND DISCRIMINATOR=?]
       [AND RELATION_DISCRIM=?]
       
      Returns:
      Statement for retrieving the contents of the Collection.
    • getContainsStatementString

      private String getContainsStatementString(Object element)
    • getRemoveStmt

      protected String getRemoveStmt(Object element)
      Generate statement for removing an element from the Collection.
       DELETE FROM COLLTABLE WHERE OWNERCOL=? AND ELEMENTCOL = ?
       
      Parameters:
      element - The element to remove
      Returns:
      Statement for deleting an item from the Collection.
    • getRemoveStatementString

      private String getRemoveStatementString(Object element)
    • updateEmbeddedElement

      public boolean updateEmbeddedElement(org.datanucleus.state.DNStateManager sm, E element, int fieldNumber, Object value)
      Method to update a field of an embedded element.
      Specified by:
      updateEmbeddedElement in interface org.datanucleus.store.types.scostore.CollectionStore<E>
      Parameters:
      sm - StateManager of the owner
      element - The element to update
      fieldNumber - The number of the field to update
      value - The value
      Returns:
      true if the datastore was updated
    • getUpdateEmbeddedElementStmt

      protected String getUpdateEmbeddedElementStmt(JavaTypeMapping fieldMapping)
      Generate statement for update the field of an embedded element.
       UPDATE SETTABLE
       SET EMBEDDEDFIELD1 = ?
       WHERE OWNERCOL=?
       AND ELEMENTCOL = ?
       
      Parameters:
      fieldMapping - The mapping for the field within the embedded object to be updated
      Returns:
      Statement for updating an embedded element in the Set