@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Inherited @Import(value=com.holonplatform.jpa.spring.internal.JpaDatastoreRegistrar.class) @EnableDatastoreConfiguration public @interface EnableJpaDatastore
Datastore.
For successful Datastore registration, an EntityManagerFactory bean must be available in context. If
no data context is specified, a bean named entityManagerFactory is required. Otherwise, an
EntityManagerFactory bean named using pattern dataContextId_entityManagerFactory is required. A custom
EntityManagerFactory bean name can be configured using entityManagerFactoryReference() attribute.
The registered bean name will be DEFAULT_DATASTORE_BEAN_NAME if dataContextId() is not specified.
Otherwise, the registered bean name will be the composition of the data context id and the default bean name using
this pattern: DEFAULT_DATASTORE_BEAN_NAME + _dataContextId.
JpaDatastore| Modifier and Type | Fields and Description |
|---|---|
static String |
DEFAULT_DATASTORE_BEAN_NAME
Default
Datastore registration bean name. |
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
autoFlush
Get whether to enable the auto-flush mode.
|
String |
dataContextId
Optional data context id to use to discriminate Datastores when more than one persistence source is configured,
i.e. when multiple DataSources and JPA persistence units are configured in context.
|
String |
entityManagerFactoryReference
Configures the name of the
EntityManagerFactory bean definition to be used to create the
Datastore registered using this annotation. |
com.holonplatform.spring.PrimaryMode |
primary
Whether to qualify
Datastore bean as primary, i.e. the preferential bean to be injected in a
single-valued dependency when multiple candidates are present. |
boolean |
transactional
Get whether to add
Transactional behaviour to transactional Datastore methods, to automatically
create or partecipate in a transaction when methods are invoked. |
public static final String DEFAULT_DATASTORE_BEAN_NAME
Datastore registration bean name.public abstract String dataContextId
The configured data context id will be returned by the DataContextBound.getDataContextId() method of the
registered Datastore.
When a data context id is specified, the registered Datastore should be bound to the EntityManagerFactory with a
persistence unit name which matches the data context id. During registration phase, if the data context id is not
null/empty and a entityManagerFactoryReference() is not specified, an EntityManagerFactory bean is
searched in context using the bean name pattern: entityManagerFactory_[datacontextid] where
[datacontextid] is equal to dataContextId() attribute.
public abstract String entityManagerFactoryReference
EntityManagerFactory bean definition to be used to create the
Datastore registered using this annotation. See dataContextId() for informations about
EntityManagerFactory bean lookup when a specific name is not configured.EntityManagerFactory bean definition to be used to create the Datastorepublic abstract com.holonplatform.spring.PrimaryMode primary
Datastore bean as primary, i.e. the preferential bean to be injected in a
single-valued dependency when multiple candidates are present.
When mode is PrimaryMode.AUTO, the registred Datastore bean is marked as primary only when the
EntityManagerFactory bean to which is bound is registered as primary bean.
PrimaryMode.AUTOpublic abstract boolean autoFlush
EntityManager.flush() is
called after each Datastore data manipulation operation, such as save or delete
operations.
Default is false.
true to enable the auto-flush mode, false to disablepublic abstract boolean transactional
Transactional behaviour to transactional Datastore methods, to automatically
create or partecipate in a transaction when methods are invoked. Affected methods are:
Datastore.refresh(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox)Datastore.insert(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.DatastoreOperations.WriteOption...)Datastore.update(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.DatastoreOperations.WriteOption...)Datastore.save(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.DatastoreOperations.WriteOption...)Datastore.delete(com.holonplatform.core.datastore.DataTarget, com.holonplatform.core.property.PropertyBox, com.holonplatform.core.datastore.DatastoreOperations.WriteOption...)Transactional behaviour to transactional datastore methods. Defaults to
true.Copyright © 2019 The Holon Platform. All rights reserved.