public class DefaultJpaDatastore extends com.holonplatform.core.internal.datastore.AbstractInitializableDatastore<JpaDatastoreCommodityContext> implements JpaDatastore, JpaDatastoreCommodityContext
JpaDatastore implementation.
The Datastore instance must be initialized using the AbstractInitializableDatastore.initialize() method before using it.
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultJpaDatastore.AbstractBuilder<D extends JpaDatastore,I extends DefaultJpaDatastore>
Default
JpaDatastore.Builder. |
static class |
DefaultJpaDatastore.DefaultBuilder
Default
JpaDatastore.Builder. |
JpaDatastore.Builder<D extends JpaDatastore>, JpaDatastore.EntityManagerFinalizer, JpaDatastore.EntityManagerInitializer, JpaDatastore.EntityManagerLifecycleHandlercom.holonplatform.core.datastore.Datastore.OperationResult, com.holonplatform.core.datastore.Datastore.OperationTypeQUERY_PARAMETER_FLUSH_MODE, QUERY_PARAMETER_LOCK_MODE| Constructor and Description |
|---|
DefaultJpaDatastore()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
com.holonplatform.core.beans.BeanIntrospector |
getBeanIntrospector()
Get the
BeanIntrospector to use to introspect entity beans. |
ORMDialect |
getDialect()
Get the
ORMDialect to use. |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Get the EntityManagerFactory.
|
Optional<ORMPlatform> |
getORMPlatform()
Get the ORM platform, if detected.
|
boolean |
isAutoFlush()
Checks whether to auto-flush mode is enabled.
|
void |
setAutoFlush(boolean autoFlush)
Set whether to auto-flush mode is enabled.
|
void |
setDialect(ORMDialect dialect)
Set the ORM dialect
|
void |
setEntityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)
Set EntityManagerFactory to obtain EntityManager references
|
void |
setEntityManagerFinalizer(JpaDatastore.EntityManagerFinalizer entityManagerFinalizer)
Sets the
EntityManager finalizer to use after Datastore operations execution. |
void |
setEntityManagerInitializer(JpaDatastore.EntityManagerInitializer entityManagerInitializer)
Sets the
EntityManager instance provider for Datastore operations execution |
void |
setORMPlatform(ORMPlatform platform)
Set the
ORMPlatform. |
void |
setTransactionFactory(JpaTransactionFactory transactionFactory)
Set the
JpaTransactionFactory to use to create a new JPA transaction. |
void |
trace(String jpql)
Trace given JPQL statement.
|
void |
traceOperation(String operation)
Trace given JPA operation.
|
<R> R |
withEntityManager(EntityManagerOperation<R> operation)
Execute given
operation using an EntityManager instance provided by the Datastore and return
the operation result. |
<R> R |
withTransaction(com.holonplatform.core.datastore.transaction.TransactionalOperation<R> operation,
com.holonplatform.core.datastore.transaction.TransactionConfiguration transactionConfiguration) |
getInitializationClassLoader, initialize, isInitialized, setInitializationClassLoaderaddExpressionResolver, create, getAvailableCommodities, getCommodityFactoryType, getDataContextId, getExpressionResolvers, getExpressionResolverType, isTraceEnabled, registerCommodity, removeExpressionResolver, resolve, setDataContextId, setTraceEnabled, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitbuilderbulkDelete, bulkInsert, bulkUpdate, delete, insert, isTransactional, query, query, refresh, requireTransactional, save, updatecreate, getAvailableCommodities, hasCommodityaddExpressionResolver, addExpressionResolvers, removeExpressionResolverwithTransaction, withTransaction, withTransactiongetCommodityFactoryType, registerCommoditygetValueDeserializer, getValueSerializergetExpressionResolverswithEntityManagerpublic void setEntityManagerFactory(javax.persistence.EntityManagerFactory entityManagerFactory)
entityManagerFactory - EntityManagerFactory to set, must be not nullpublic javax.persistence.EntityManagerFactory getEntityManagerFactory()
JpaContextgetEntityManagerFactory in interface JpaContextpublic boolean isAutoFlush()
JpaOperationContextEntityManager.flush() is
called after each Datastore data manipulation operation, such as save or delete.isAutoFlush in interface JpaOperationContexttrue if auto-flush mode is enabled, false otherwisepublic void setAutoFlush(boolean autoFlush)
EntityManager.flush() is
called after each Datastore data manipulation operation, such as save or delete.autoFlush - true to enable the auto-flush mode, false to disablepublic ORMDialect getDialect()
JpaContextORMDialect to use.getDialect in interface JpaContextpublic void setDialect(ORMDialect dialect)
dialect - the dialect to setpublic com.holonplatform.core.beans.BeanIntrospector getBeanIntrospector()
JpaOperationContextBeanIntrospector to use to introspect entity beans.getBeanIntrospector in interface JpaOperationContextpublic void trace(String jpql)
JpaContext
If tracing is enabled, the JPQL statement is logged using the INFO level, otherwise it is logged
using the DEBUG level.
trace in interface JpaContextjpql - JPQL to tracepublic void traceOperation(String operation)
JpaContext
If tracing is enabled, the operation is logged using the INFO level, otherwise it is logged using
the DEBUG level.
traceOperation in interface JpaContextoperation - Operation to tracepublic Optional<ORMPlatform> getORMPlatform()
JpaContextgetORMPlatform in interface JpaContextpublic void setORMPlatform(ORMPlatform platform)
ORMPlatform.platform - the platform to setpublic void setEntityManagerInitializer(JpaDatastore.EntityManagerInitializer entityManagerInitializer)
EntityManager instance provider for Datastore operations executionentityManagerInitializer - the EntityManagerInitializer to setpublic void setEntityManagerFinalizer(JpaDatastore.EntityManagerFinalizer entityManagerFinalizer)
EntityManager finalizer to use after Datastore operations execution.entityManagerFinalizer - the EntityManagerFinalizer to setpublic <R> R withEntityManager(EntityManagerOperation<R> operation)
EntityManagerHandleroperation using an EntityManager instance provided by the Datastore and return
the operation result.
The EntityManager lifecycle is managed by the JPA Datastore, including creation and closing.
withEntityManager in interface EntityManagerHandlerR - Operation result typeoperation - The operation to execute (not null)public <R> R withTransaction(com.holonplatform.core.datastore.transaction.TransactionalOperation<R> operation,
com.holonplatform.core.datastore.transaction.TransactionConfiguration transactionConfiguration)
withTransaction in interface com.holonplatform.core.datastore.transaction.Transactionalpublic void setTransactionFactory(JpaTransactionFactory transactionFactory)
JpaTransactionFactory to use to create a new JPA transaction.transactionFactory - the transaction factory to set (not null)Copyright © 2019 The Holon Platform. All rights reserved.