com.holonplatform.datastore.jpa

## Interface JpaDatastore

- All Superinterfaces:
    com.holonplatform.core.datastore.DataContextBound, com.holonplatform.core.datastore.Datastore, com.holonplatform.core.datastore.DatastoreCommodityRegistrar<JpaDatastoreCommodityContext>, com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport, Serializable
  All Known Subinterfaces:
    JpaDatastoreCommodityContext, SpringJpaDatastore

      public interface JpaDatastore
      extends com.holonplatform.core.datastore.Datastore, com.holonplatform.core.datastore.DatastoreCommodityRegistrar<JpaDatastoreCommodityContext>

  JPA `Datastore`.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `JpaDatastore.Builder<D extends JpaDatastore>` `JpaDatastore` builder.
    `static interface` | `JpaDatastore.EntityManagerFinalizer` Interface to perform any close/finalize operation on the `EntityManager` instance used for a Datastore operation execution
    `static interface` | `JpaDatastore.EntityManagerInitializer` Interface to provide `EntityManager` instance to use when executing a Datastore operation
    `static interface` | `JpaDatastore.EntityManagerOperation<R>` Represents an operation to be executed using a Datastore managed `EntityManager`.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.datastore.Datastore

      `com.holonplatform.core.datastore.Datastore.OperationResult, com.holonplatform.core.datastore.Datastore.OperationType, com.holonplatform.core.datastore.Datastore.WriteOption`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `QUERY_PARAMETER_LOCK_MODE` `Query` parameter to set lock mode (use `QueryBuilder.parameter(String, Object)` to set query parameters).

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JpaDatastore.Builder<JpaDatastore>` | `builder()` Get a builder to create a `JpaDatastore` instance.
    `<R> R` | `withEntityManager(JpaDatastore.EntityManagerOperation<R> operation)` Execute given `operation` using an `EntityManager` instance provided by the Datastore and return the operation result.

    - ### Methods inherited from interface com.holonplatform.core.datastore.Datastore

      `bulkDelete, bulkInsert, bulkUpdate, create, delete, getAvailableCommodities, insert, query, refresh, save, update`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolver, getExpressionResolvers, removeExpressionResolver`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DataContextBound

      `getDataContextId`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DatastoreCommodityRegistrar

      `getCommodityFactoryType, registerCommodity`

- - ### Field Detail

    - #### QUERY_PARAMETER_LOCK_MODE

          static final String QUERY_PARAMETER_LOCK_MODE

      `Query` parameter to set lock mode (use `QueryBuilder.parameter(String, Object)` to set query parameters).

      Value must be `LockModeType` enum value.

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### withEntityManager

          <R> R withEntityManager(JpaDatastore.EntityManagerOperation<R> operation)

      Execute given `operation` using an `EntityManager` instance provided by the Datastore and return the operation result.

      The `EntityManager` lifecycle is managed by Datastore, obtaining an instance using `JpaDatastore.EntityManagerInitializer` and performing any close operation using `JpaDatastore.EntityManagerFinalizer`.

      Type Parameters:
        `R` - Operation result type
      Parameters:
        `operation` - The operation to execute (not null)
      Returns:
        Operation result
      Throws:
        `IllegalStateException` - If a `EntityManagerFactory` is not available
        `com.holonplatform.core.exceptions.DataAccessException` - If an error occurred during `EntityManager` management or operation execution

    - #### builder

          static JpaDatastore.Builder<JpaDatastore> builder()

      Get a builder to create a `JpaDatastore` instance.
      Returns:
        Datastore builder

Copyright © 2017 The Holon Platform. All rights reserved.