com.h3c.util.dao

## Class DataStoreManager

- java.lang.Object
- - com.h3c.util.dao.DataStoreManager

- All Implemented Interfaces:
    DataStoreService

      public class DataStoreManager
      extends Object
      implements DataStoreService

  Basic implementation of the Data Store Service using JPA. A constructor is provided to seed the Entity Manager Factory for use by this class.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataStoreManager(javax.persistence.EntityManagerFactory emf, org.slf4j.Logger log)` Construct the instance to use the provided entity manager factory

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `execute(ReadQuery<T> query)` Executes a query operation on the persistence layer.
    `<T> T` | `execute(WriteQuery<T> update)` Executes an update operation on the persistence layer.

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

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

- - ### Constructor Detail

    - #### DataStoreManager

          public DataStoreManager(javax.persistence.EntityManagerFactory emf,
                          org.slf4j.Logger log)

      Construct the instance to use the provided entity manager factory
      Parameters:
        `emf` - the entity manager factory to be used.
        `log` - the Logger implementation to use

  - ### Method Detail

    - #### execute

          public <T> T execute(ReadQuery<T> query)
                    throws Exception

      Description copied from interface: `DataStoreService`
      Executes a query operation on the persistence layer.
      Specified by:
        `execute` in interface `DataStoreService`
      Type Parameters:
        `T` - type of the query result.
      Parameters:
        `query` - the query to execute.
      Returns:
        the query result.
      Throws:
        `Exception` - if exception happen while executing the query.

    - #### execute

          public <T> T execute(WriteQuery<T> update)
                    throws Exception

      Description copied from interface: `DataStoreService`
      Executes an update operation on the persistence layer.
      Specified by:
        `execute` in interface `DataStoreService`
      Type Parameters:
        `T` - type of the update result.
      Parameters:
        `update` - the database update to execute.
      Returns:
        the update result.
      Throws:
        `Exception` - if exception happen while executing the update.

Copyright © 2014. All Rights Reserved.