Interface GenericDao<T extends net.solarnetwork.dao.Entity<PK>,PK extends Serializable>

Type Parameters:
T - the domain object type
PK - the primary key type
All Known Subinterfaces:
SolarLocationDao, SolarNodeDao, SolarNodeMetadataDao
All Known Implementing Classes:
BaseMyBatisFilterableDao, BaseMyBatisGenericDao, MyBatisSolarLocationDao, MyBatisSolarNodeDao, MyBatisSolarNodeMetadataDao

public interface GenericDao<T extends net.solarnetwork.dao.Entity<PK>,PK extends Serializable>
Generic DAO API.

Based in part on http://www-128.ibm.com/developerworks/java/library/j-genericdao.html.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(T domainObject)
    Remove an object from persistent storage in the database.
    get(PK id)
    Get a persisted domain object by its primary key.
    getAll(List<net.solarnetwork.domain.SortDescriptor> sortDescriptors)
    Get a list of persisted domain objects, optionally sorted in some way.
    Class<? extends T>
    Get the class supported by this Dao.
    store(T domainObject)
    Persist the domainObject object into database, creating or updating as appropriate.
  • Method Details

    • getObjectType

      Class<? extends T> getObjectType()
      Get the class supported by this Dao.
      Returns:
      class
    • store

      PK store(T domainObject)
      Persist the domainObject object into database, creating or updating as appropriate.
      Parameters:
      domainObject - the domain object so store
      Returns:
      the primary key of the stored object
    • get

      T get(PK id)
      Get a persisted domain object by its primary key.
      Parameters:
      id - the primary key to retrieve
      Returns:
      the domain object
    • getAll

      List<T> getAll(List<net.solarnetwork.domain.SortDescriptor> sortDescriptors)
      Get a list of persisted domain objects, optionally sorted in some way.

      The sortDescriptors parameter can be null, in which case the sort order is not defined and implementation specific.

      Parameters:
      sortDescriptors - list of sort descriptors to sort the results by
      Returns:
      list of all persisted domain objects, or empty list if none available
      Since:
      1.2
    • delete

      void delete(T domainObject)
      Remove an object from persistent storage in the database.
      Parameters:
      domainObject - the domain object to delete