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
Modifier and TypeClassDescriptionprotected static class
Helps 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
Modifier and TypeFieldDescriptionprotected AccessManager
protected org.springframework.context.ApplicationContext
protected DbmsSpecifics
protected EntityChangedEventManager
protected EntityEventManager
protected ExtendedEntities
protected FetchPlanRepository
protected FetchPlans
protected org.springframework.beans.factory.ObjectProvider<JpqlQueryBuilder>
static final String
protected EclipselinkPersistenceSupport
protected DataProperties
protected QueryResultsManager
protected QueryTransformerFactory
static final String
protected StoreAwareLocator
protected String
protected static final AtomicLong
Fields inherited from class io.jmix.core.datastore.AbstractDataStore
entityStates, keyValueMapper, listeners, metadata, metadataTools
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
beforeLoadTransactionCommit
(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) protected void
beforeSaveTransactionCommit
(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) protected void
beforeSaveTransactionRollback
(SaveContext context) protected Object
beginLoadTransaction
(boolean joinTransaction) protected Object
beginSaveTransaction
(boolean joinTransaction) protected void
commitTransaction
(Object transaction) protected long
countAll
(LoadContext<?> context) protected long
countAllValues
(ValueLoadContext context) protected FetchPlan
createFetchPlan
(LoadContext<?> context) protected jakarta.persistence.Query
createLoadQuery
(jakarta.persistence.EntityManager em, ValueLoadContext context, boolean count) protected jakarta.persistence.Query
createQuery
(jakarta.persistence.EntityManager em, LoadContext<?> context, boolean countQuery) deleteAll
(SaveContext context) protected <E> void
detachEntity
(jakarta.persistence.EntityManager em, E rootEntity, FetchPlan fetchPlan, boolean loadedOnly) executeQuery
(jakarta.persistence.Query query, boolean singleResult) getName()
This data store instance name with which it is registered inStores
.protected JpaDataStore.JpaTransactionContextState
getTransactionContextState
(boolean isJoinTransaction) Invoked afterAbstractDataStore.beginLoadTransaction(boolean)
.protected Pattern
boolean
protected boolean
isSingleResult
(LoadContext<?> context) loadAll
(LoadContext<?> context) loadAllByIdBatches
(LoadContext<?> context, jakarta.persistence.EntityManager em) loadAllByIds
(LoadContext<?> context, jakarta.persistence.EntityManager em) loadAllValues
(ValueLoadContext context) protected Object
loadOne
(LoadContext<?> context) protected String
resolveConstraintName
(Matcher matcher) protected void
rollbackTransaction
(Object transaction) Set<?>
save
(SaveContext context) Saves a collection of entity instances.saveAll
(SaveContext context) void
Sets this data store instance name with which it is registered inStores
.boolean
Methods 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:DataStore
This data store instance name with which it is registered inStores
. -
setName
Description copied from interface:DataStore
Sets this data store instance name with which it is registered inStores
. -
loadOne
- Specified by:
loadOne
in classAbstractDataStore
-
loadAll
- Specified by:
loadAll
in classAbstractDataStore
-
loadAllByIds
-
loadAllByIdBatches
protected List<Object> loadAllByIdBatches(LoadContext<?> context, jakarta.persistence.EntityManager em) -
countAll
- Specified by:
countAll
in classAbstractDataStore
-
save
Description copied from interface:DataStore
Saves a collection of entity instances.- Specified by:
save
in interfaceDataStore
- Overrides:
save
in classAbstractDataStore
- Returns:
- set of saved instances
-
saveAll
- Specified by:
saveAll
in classAbstractDataStore
-
deleteAll
- Specified by:
deleteAll
in classAbstractDataStore
-
loadAllValues
- Specified by:
loadAllValues
in classAbstractDataStore
-
countAllValues
- Specified by:
countAllValues
in classAbstractDataStore
-
beginLoadTransaction
- Specified by:
beginLoadTransaction
in classAbstractDataStore
-
getTransactionContextState
protected JpaDataStore.JpaTransactionContextState getTransactionContextState(boolean isJoinTransaction) Description copied from class:AbstractDataStore
Invoked afterAbstractDataStore.beginLoadTransaction(boolean)
.
Override this method to createAbstractDataStore.TransactionContextState
implementation and store required data in it.- Specified by:
getTransactionContextState
in classAbstractDataStore
-
beforeLoadTransactionCommit
protected void beforeLoadTransactionCommit(LoadContext<?> context, Collection<Object> entities, AbstractDataStore.TransactionContextState transactionContextState) - Overrides:
beforeLoadTransactionCommit
in classAbstractDataStore
-
rollbackTransaction
- Specified by:
rollbackTransaction
in classAbstractDataStore
-
commitTransaction
- Specified by:
commitTransaction
in classAbstractDataStore
-
beginSaveTransaction
- Specified by:
beginSaveTransaction
in classAbstractDataStore
-
beforeSaveTransactionCommit
protected void beforeSaveTransactionCommit(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities) - Overrides:
beforeSaveTransactionCommit
in classAbstractDataStore
-
beforeSaveTransactionRollback
- Overrides:
beforeSaveTransactionRollback
in classAbstractDataStore
-
createQuery
protected jakarta.persistence.Query createQuery(jakarta.persistence.EntityManager em, LoadContext<?> context, boolean countQuery) -
createLoadQuery
protected jakarta.persistence.Query createLoadQuery(jakarta.persistence.EntityManager em, ValueLoadContext context, boolean count) -
createFetchPlan
-
executeQuery
-
detachEntity
protected <E> void detachEntity(jakarta.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:
isNullsLastSorting
in interfaceDataSortingOptions
- Returns:
- default sort order of null values
-
supportsLobSortingAndFiltering
public boolean supportsLobSortingAndFiltering()- Specified by:
supportsLobSortingAndFiltering
in interfaceDataSortingOptions
- Returns:
- true if the data store supports equality check and sorting for LOB columns
-
getUniqueConstraintViolationPattern
-
resolveConstraintName
-