Package io.jmix.core

Interface DataStore

All Known Implementing Classes:
AbstractDataStore, JpaDataStore, NoopDataStore, TestInMemoryDataStore

public interface DataStore
Interface defining methods for CRUD operations on entities.

Implementations of this interface must be prototype beans. They are used by DataManager, do not access data stores directly from your application code.

  • Method Details

    • getName

      String getName()
      This data store instance name with which it is registered in Stores.
    • setName

      void setName(String name)
      Sets this data store instance name with which it is registered in Stores.
    • load

      @Nullable Object load(LoadContext<?> context)
      Loads a single entity instance.
      Returns:
      the loaded object, or null if not found
    • loadList

      List<Object> loadList(LoadContext<?> context)
      Loads collection of entity instances.
      Returns:
      a list of instances, or empty list if nothing found
    • getCount

      long getCount(LoadContext<?> context)
      Returns the number of entity instances for the given query passed in the LoadContext.
      Returns:
      number of instances in the storage
    • save

      Set<?> save(SaveContext context)
      Saves a collection of entity instances.
      Returns:
      set of saved instances
    • loadValues

      List<KeyValueEntity> loadValues(ValueLoadContext context)
      Loads list of key-value pairs.
      Parameters:
      context - defines a query for scalar values and a list of keys for returned KeyValueEntity
      Returns:
      list of KeyValueEntity instances
    • getCount

      long getCount(ValueLoadContext context)
      Returns the number of key-value pairs for the given query passed in the ValueLoadContext.
      Parameters:
      context - defines the query
      Returns:
      number of key-value pairs in the data store