com.h3c.util.dao

## Interface DependentUpdater<P extends Storable<?>,T extends Transportable<? super T,?>>

- Type Parameters:
    `P` - type of the dependent persistent object.
    `T` - type of the dependent transport object.

      public interface DependentUpdater<P extends Storable<?>,T extends Transportable<? super T,?>>

  Dependent updater.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(T dependent)` Adds a new dependent.
    `void` | `delete(P dependent)` Deletes a dependent.
    `void` | `update(P dependentTarget, T dependentSource)` Updates a dependent.

- - ### Method Detail

    - #### add

          void add(T dependent)

      Adds a new dependent. It is usually enough adding the dependent entity to the collection of dependents. JPA will do the rest.
      1. Create entity

         `DependentEntity entity = new DependentEntity(dependent);`

         `DependentEntity entity = dependentDao.create(dependent,...);`

      2. Add entity to the collection of dependents

         `dependents.add(dependentEntity);`

      3. (Optional) If the relation is bidirectional, set independent entity to the dependent

         `dependent.setOwner(idependent);`

      Parameters:
        `dependent` - the dependent to add.

    - #### update

          void update(P dependentTarget,
                    T dependentSource)

      Updates a dependent. It is usually enough conforming the dependent entity and the transport object. JPA will do the rest.
      Parameters:
        `dependentTarget` - object to update.
        `dependentSource` - object to take the data from.

    - #### delete

          void delete(P dependent)

      Deletes a dependent. It is usually enough deleting the dependent from the collection of dependents. JPA will do the rest.

      Example:

      `dependents.remove(dependent);`

      Parameters:
        `dependent` - dependent to delete.

Copyright © 2014. All Rights Reserved.