com.h3c.util.persistence.cassandra.query

## Class AddQuery<T extends TransportObject<? super T,?>,P extends Storable<?>,C>

- java.lang.Object
- - com.h3c.util.persistence.cassandra.query.AddQuery<T,P,C>

- Type Parameters:
    `P` - Type of the result of the query from the Dao.
    `T` - Type of the result
    `C` - Type of Data Store Context
  All Implemented Interfaces:
    WriteQuery<T,C>

      public class AddQuery<T extends TransportObject<? super T,?>,P extends Storable<?>,C>
      extends Object
      implements WriteQuery<T,C>

  AddQuery is used by the consumers of DataStore Service to create a row in a table/column family of a database. In general, the Query objects in persistence framework cache a `TransportObject` object and `Dao` object. These objects help in execution of the query.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AddQuery(T transportable, Dao<?,T,P,?,?,C> dao)` Provides ability for the business logic to perform Write operations on the persistence layer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `execute(C context)` This is the single execute method provided by the WriteQuery interface.

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

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

- - ### Constructor Detail

    - #### AddQuery

          public AddQuery(T transportable,
                  Dao<?,T,P,?,?,C> dao)

      Provides ability for the business logic to perform Write operations on the persistence layer. The applications use DAO to perform all database operations and the AddQuery provides methods that DAO can use to take the user query to the lower tiers and persist the data in the database.
      Parameters:
        `transportable` -
        `dao` -

  - ### Method Detail

    - #### execute

          public T execute(C context)
                                                         throws Exception

      This is the single execute method provided by the WriteQuery interface. The application/business logic prepares a Add query and as the last step, calls this method to transmit data to the underlying tiers. This data is persisted using DAO and Entity Manager.
      Specified by:
        `execute` in interface `WriteQuery<T extends TransportObject<? super T,?>,C>`
      Parameters:
        `context` - Context to execute the query
      Returns:
        result of AddQuery operation.
      Throws:
        `NullPointerException` - In case of context is null.
        `Exception` - Throws Exception in case of any error in query execute.

Copyright © 2014. All Rights Reserved.