Package io.jmix.eclipselink.impl
Class JpaDataStore
java.lang.Object
io.jmix.core.datastore.AbstractDataStore
io.jmix.eclipselink.impl.JpaDataStore
- All Implemented Interfaces:
DataSortingOptions,DataStore
@Component("eclipselink_JpaDataStore")
@Scope("prototype")
public class JpaDataStore
extends AbstractDataStore
implements DataSortingOptions
INTERNAL.
Implementation of the
DataStore interface working with a relational database using JPA.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classHelps to distinguish newly loaded entities (including implicitly loaded) from already existed.Nested classes/interfaces inherited from class io.jmix.core.datastore.AbstractDataStore
AbstractDataStore.EntityLoadInfo, AbstractDataStore.TransactionContextState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessManagerprotected org.springframework.context.ApplicationContextprotected DbmsSpecificsprotected EntityChangedEventManagerprotected EntityEventManagerprotected ExtendedEntitiesprotected FetchPlanRepositoryprotected FetchPlansprotected org.springframework.beans.factory.ObjectProvider<JpqlQueryBuilder>static final Stringprotected EclipselinkPersistenceSupportprotected DataPropertiesprotected QueryResultsManagerprotected QueryTransformerFactorystatic final Stringprotected StoreAwareLocatorprotected Stringprotected static final AtomicLongFields inherited from class io.jmix.core.datastore.AbstractDataStore
entityStates, keyValueMapper, listeners, metadata, metadataTools -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbeforeLoadTransactionCommit(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) protected voidbeforeSaveTransactionCommit(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) protected voidbeforeSaveTransactionRollback(SaveContext context) protected ObjectbeginLoadTransaction(boolean joinTransaction) protected ObjectbeginSaveTransaction(boolean joinTransaction) protected voidcommitTransaction(Object transaction) protected longcountAll(LoadContext<?> context) protected longcountAllValues(ValueLoadContext context) protected FetchPlancreateFetchPlan(LoadContext<?> context) protected javax.persistence.QuerycreateLoadQuery(javax.persistence.EntityManager em, ValueLoadContext context, boolean count) protected javax.persistence.QuerycreateQuery(javax.persistence.EntityManager em, LoadContext<?> context, boolean countQuery) deleteAll(SaveContext context) protected <E> voiddetachEntity(javax.persistence.EntityManager em, E rootEntity, FetchPlan fetchPlan, boolean loadedOnly) executeQuery(javax.persistence.Query query, boolean singleResult) getName()This data store instance name with which it is registered inStores.protected JpaDataStore.JpaTransactionContextStategetTransactionContextState(boolean isJoinTransaction) Invoked afterAbstractDataStore.beginLoadTransaction(boolean).protected Patternbooleanprotected booleanisSingleResult(LoadContext<?> context) loadAll(LoadContext<?> context) loadAllByIdBatches(LoadContext<?> context, javax.persistence.EntityManager em) loadAllByIds(LoadContext<?> context, javax.persistence.EntityManager em) loadAllValues(ValueLoadContext context) protected ObjectloadOne(LoadContext<?> context) protected StringresolveConstraintName(Matcher matcher) protected voidrollbackTransaction(Object transaction) Set<?>save(SaveContext context) Saves a collection of entity instances.saveAll(SaveContext context) voidSets this data store instance name with which it is registered inStores.booleanMethods inherited from class io.jmix.core.datastore.AbstractDataStore
checkAndReorderLoadedEntities, copyNonPersistentAttributes, fireEvent, getCount, getCount, getFetchPlanForSave, load, loadAllAfterSave, loadList, loadListByBatches, loadValues, registerInterceptor, setEntityStates, setKeyValueMapper, setMetadata, setMetadataTools
-
Field Details
-
LOAD_TX_PREFIX
- See Also:
-
SAVE_TX_PREFIX
- See Also:
-
properties
-
fetchPlans
-
accessManager
-
queryResultsManager
-
queryTransformerFactory
-
entityChangedEventManager
-
entityEventManager
-
dbmsSpecifics
-
storeAwareLocator
-
applicationContext
@Autowired protected org.springframework.context.ApplicationContext applicationContext -
extendedEntities
-
jpqlQueryBuilderProvider
@Autowired protected org.springframework.beans.factory.ObjectProvider<JpqlQueryBuilder> jpqlQueryBuilderProvider -
persistenceSupport
-
fetchPlanRepository
-
storeName
-
txCount
-
-
Constructor Details
-
JpaDataStore
public JpaDataStore()
-
-
Method Details
-
getName
Description copied from interface:DataStoreThis data store instance name with which it is registered inStores. -
setName
Description copied from interface:DataStoreSets this data store instance name with which it is registered inStores. -
loadOne
- Specified by:
loadOnein classAbstractDataStore
-
loadAll
- Specified by:
loadAllin classAbstractDataStore
-
loadAllByIds
-
loadAllByIdBatches
protected List<Object> loadAllByIdBatches(LoadContext<?> context, javax.persistence.EntityManager em) -
countAll
- Specified by:
countAllin classAbstractDataStore
-
save
Description copied from interface:DataStoreSaves a collection of entity instances.- Specified by:
savein interfaceDataStore- Overrides:
savein classAbstractDataStore- Returns:
- set of saved instances
-
saveAll
- Specified by:
saveAllin classAbstractDataStore
-
deleteAll
- Specified by:
deleteAllin classAbstractDataStore
-
loadAllValues
- Specified by:
loadAllValuesin classAbstractDataStore
-
countAllValues
- Specified by:
countAllValuesin classAbstractDataStore
-
beginLoadTransaction
- Specified by:
beginLoadTransactionin classAbstractDataStore
-
getTransactionContextState
protected JpaDataStore.JpaTransactionContextState getTransactionContextState(boolean isJoinTransaction) Description copied from class:AbstractDataStoreInvoked afterAbstractDataStore.beginLoadTransaction(boolean).
Override this method to createAbstractDataStore.TransactionContextStateimplementation and store required data in it.- Specified by:
getTransactionContextStatein classAbstractDataStore
-
beforeLoadTransactionCommit
protected void beforeLoadTransactionCommit(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) - Overrides:
beforeLoadTransactionCommitin classAbstractDataStore
-
rollbackTransaction
- Specified by:
rollbackTransactionin classAbstractDataStore
-
commitTransaction
- Specified by:
commitTransactionin classAbstractDataStore
-
beginSaveTransaction
- Specified by:
beginSaveTransactionin classAbstractDataStore
-
beforeSaveTransactionCommit
protected void beforeSaveTransactionCommit(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) - Overrides:
beforeSaveTransactionCommitin classAbstractDataStore
-
beforeSaveTransactionRollback
- Overrides:
beforeSaveTransactionRollbackin classAbstractDataStore
-
createQuery
protected javax.persistence.Query createQuery(javax.persistence.EntityManager em, LoadContext<?> context, boolean countQuery) -
createLoadQuery
protected javax.persistence.Query createLoadQuery(javax.persistence.EntityManager em, ValueLoadContext context, boolean count) -
createFetchPlan
-
executeQuery
-
detachEntity
protected <E> void detachEntity(javax.persistence.EntityManager em, @Nullable E rootEntity, @Nullable FetchPlan fetchPlan, boolean loadedOnly) -
isSingleResult
- Parameters:
context- - loading context- Returns:
- false if maxResults=1 and the query is not by ID we should not use getSingleResult() for backward compatibility
-
isNullsLastSorting
public boolean isNullsLastSorting()- Specified by:
isNullsLastSortingin interfaceDataSortingOptions- Returns:
- default sort order of null values
-
supportsLobSortingAndFiltering
public boolean supportsLobSortingAndFiltering()- Specified by:
supportsLobSortingAndFilteringin interfaceDataSortingOptions- Returns:
- true if the data store supports equality check and sorting for LOB columns
-
getUniqueConstraintViolationPattern
-
resolveConstraintName
-