com.h3c.util.dao.query

## Class DaoTryAddQuery<I extends Serializable,P extends Storable<I>,T extends Transportable<? super T,I>>

- java.lang.Object
- - com.h3c.util.dao.WriteQuery<Boolean>
  - - com.h3c.util.dao.query.DaoTryAddQuery<I,P,T>

- Type Parameters:
    `I` - type of the persistent object and transport object id.
    `P` - type of model persistent object.
    `T` - type of the transport object.

      public class DaoTryAddQuery<I extends Serializable,P extends Storable<I>,T extends Transportable<? super T,I>>
      extends WriteQuery<Boolean>

  Tries to create a new persistence layer instance of the transportable object if it does not already exist.

  Returns `true` if the object was persisted, `false` if it already existed.

  Note: This should not be used for persistent objects with auto-generated keys.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DaoTryAddQuery(T transportable, Dao<I,P,T,?,?> dao)` Creates a query.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Boolean` | `execute(DataStoreContext context)` Executes the query.

    - ### Methods inherited from class com.h3c.util.dao.WriteQuery

      `execute`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DaoTryAddQuery

          public DaoTryAddQuery(T transportable,
                        Dao<I,P,T,?,?> dao)

      Creates a query.
      Parameters:
        `transportable` - transport object to add
        `dao` - the DAO to carry out the operation

  - ### Method Detail

    - #### execute

          protected Boolean execute(DataStoreContext context)

      Description copied from class: `WriteQuery`
      Executes the query.
      Specified by:
        `execute` in class `WriteQuery<Boolean>`
      Parameters:
        `context` - data store context.
      Returns:
        the result of the query.

Copyright © 2014. All Rights Reserved.