com.h3c.util.persistence

## Interface Dao<I extends Serializable,T extends TransportObject<? super T,I>,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.
    `T` - type of the transport object.
    `F` - type of the associated filter.
    `S` - type of the associated sort specification type.
    `C` - type of the data store execution context.
  All Superinterfaces:
    BaseDao<I,P,F,S,C>, Converter<P,T>
  All Known Implementing Classes:
    CassAbstractDao

      public interface Dao<I extends Serializable,T extends TransportObject<? super T,I>,P extends Storable<I>,F,S,C>
      extends BaseDao<I,P,F,S,C>, Converter<P,T>

  `Dao` is the Data Access Object. This is the layer that abstracts the underlying database implementation from the business logic. The interface methods provided by the DAO do not change when the underlying database is changed. Thus, it provides ability for plugging in and out of any underlying implementation without affecting the upper layers.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `P` | `create(T transportable, C context)` Creates a new persistent object with the data from the given transport object.
    `long` | `delete(F filter, C context)` Deletes all persistent objects matching the given filter.
    `<E extends T> Boolean` | `delete(Id<E,I> id, C context)` Deletes the persistent object with the given id.
    `long` | `deleteAll(C context)` Deletes all the persistent objects.
    `P` | `update(T transportable, C context)` Updates the persistent object related to the given transport object.

    - ### Methods inherited from interface com.h3c.util.persistence.BaseDao

      `count, find, find, findAll, get`

    - ### Methods inherited from interface com.h3c.util.Converter

      `convert`

- - ### Method Detail

    - #### create

          P create(T transportable,
                 C context)
                                       throws Exception

      Creates a new persistent object with the data from the given transport object.
      Parameters:
        `transportable` - transport object to get the data from.
        `context` - data store context.
      Returns:
        the new created persistent object.
      Throws:
        `Exception` - in case of error occurs while creating the data.

    - #### update

          P update(T transportable,
                 C context)
                                       throws Exception

      Updates the persistent object related to the given transport object.
      Parameters:
        `transportable` - transport object to get the data from.
        `context` - data store context.
      Returns:
        the updated persistent object.
      Throws:
        `Exception` - in case error occurs while updating the data.

    - #### delete

          <E extends T> Boolean delete(Id<E,I> id,
                                     C context)
                         throws Exception

      Deletes the persistent object with the given id.
      Parameters:
        `id` - persistent object's id.
        `context` - data store context.
      Returns:
        `true` if the persistent object was found and deleted, `false` if it was not found.
      Throws:
        `Exception` - throws if delete fails to operate.

    - #### delete

          long delete(F filter,
                    C context)
                      throws Exception

      Deletes all persistent objects matching the given filter.
      Parameters:
        `filter` - filter.
        `context` - data store context.
      Returns:
        number of deleted objects.
      Throws:
        `Exception` - throws if delete fails to operate.

    - #### deleteAll

          long deleteAll(C context)
                         throws Exception

      Deletes all the persistent objects.
      Parameters:
        `context` - data store context
      Returns:
        the count of entries deleted
      Throws:
        `Exception` - throws if delete fails to operate.

Copyright © 2014. All Rights Reserved.