com.h3c.util.persistence

## Interface BaseDao<I extends Serializable,P extends Storable<I>,F,S,C>

- Type Parameters:
    `I` - type of the persistent object and transport object id. This type should be immutable. It is critical this type implements equals() and hashCode() correctly.
    `P` - type of the persistent object.
    `F` - type of the associated filter.
    `S` - type of the associated sort specification type.
    `C` - type of the data store execution context.
  All Known Subinterfaces:
    Dao<I,T,P,F,S,C>
  All Known Implementing Classes:
    AbstractBaseDao, CassAbstractDao

      public interface BaseDao<I extends Serializable,P extends Storable<I>,F,S,C>

  `BaseDao` is the Base Data Access Object. This interface provides methods for all read operations from the underlying persistence storage. All methods in this DAO deal with persistent objects instead of transport objects because the result of a query not necessarily has to fit into a single transport object. Result of methods defined in this class will have to be converted to the right transport object.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `count(F filter, C context)` Gets the number of persisted objects based on a filter criteria.
    `List<P>` | `find(F filter, SortSpecification<S> sortSpecification, C context)` Get the list of persistent objects based on the given filter criteria.
    `MarkPage<P>` | `find(F filter, SortSpecification<S> sortSpecification, MarkPageRequest<?> request, C context)`
    `List<P>` | `findAll(SortSpecification<S> sortSpecification, C context)` Gets all the persistent objects.
    `P` | `get(I id, C context)` Get the persistent object with the given id.

- - ### Method Detail

    - #### get

          P get(I id,
              C context)

      Get the persistent object with the given id.
      Parameters:
        `id` - persistent object's id.
        `context` - data store context.
      Returns:
        the persistent object.

    - #### find

          List<P> find(F filter,
                     SortSpecification<S> sortSpecification,
                     C context)
                                           throws Exception

      Get the list of persistent objects based on the given filter criteria.
      Parameters:
        `filter` - filter.
        `sortSpecification` - sort specification.
        `context` - data store context.
      Returns:
        A set of persisted object instances.
      Throws:
        `Exception` - error

    - #### findAll

          List<P> findAll(SortSpecification<S> sortSpecification,
                        C context)
                                              throws Exception

      Gets all the persistent objects.
      Parameters:
        `sortSpecification` - sort specification.
        `context` - data store context.
      Returns:
        A set of persisted object instances.
      Throws:
        `Exception` - error

    - #### find

          MarkPage<P> find(F filter,
                         SortSpecification<S> sortSpecification,
                         MarkPageRequest<?> request,
                         C context)
                                               throws Exception

      Throws:
        `Exception`

    - #### count

          long count(F filter,
                   C context)
                     throws PersistenceConnException

      Gets the number of persisted objects based on a filter criteria.
      Parameters:
        `filter` - filter.
        `context` - data store context.
      Returns:
        The instances count.
      Throws:
        `PersistenceConnException` - Database connection failure exception.

Copyright © 2014. All Rights Reserved.