Class CachingBatchableEntityProvider<T>
java.lang.Object
com.vaadin.featurepack.data.jpacontainer.provider.LocalEntityProvider<T>
com.vaadin.featurepack.data.jpacontainer.provider.MutableLocalEntityProvider<T>
com.vaadin.featurepack.data.jpacontainer.provider.CachingMutableLocalEntityProvider<T>
com.vaadin.featurepack.data.jpacontainer.provider.CachingBatchableLocalEntityProvider<T>
com.vaadin.featurepack.data.jpacontainer.provider.jndijta.CachingBatchableEntityProvider<T>
- Type Parameters:
T-
- All Implemented Interfaces:
BatchableEntityProvider<T>,CachingEntityProvider<T>,EntityProvider<T>,EntityProviderChangeNotifier<T>,MutableEntityProvider<T>,JndiJtaProvider<T>,Serializable
public class CachingBatchableEntityProvider<T>
extends CachingBatchableLocalEntityProvider<T>
implements JndiJtaProvider<T>
An entity provider implementation that uses JTA transactions and JPA context
provided by the application server. To provide a generic non EJB provider
this class gets references to both
UserTransaction and
EntityManager via JNDI lookup.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.jpacontainer.BatchableEntityProvider
BatchableEntityProvider.BatchUpdateCallback<T> -
Constructor Summary
ConstructorsConstructorDescriptionCachingBatchableEntityProvider(Class<T> entityClass) CachingBatchableEntityProvider(Class<T> entityClass, JndiAddresses addresses) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.persistence.EntityManagerGets the entity manager.booleanIf this method returns true, all entities returned from this entity provider are explicitly detached from the persistence context before returned, regardless of whether the persistence context is extended or transaction-scoped.protected voidrunInTransaction(Runnable operation) IfMutableLocalEntityProvider.isTransactionsHandledByProvider()is true,operationwill be executed inside a transaction that is commited after the operation is completed.voidsetJndiAddresses(JndiAddresses addresses) Methods inherited from class com.vaadin.featurepack.data.jpacontainer.provider.CachingBatchableLocalEntityProvider
batchUpdateMethods inherited from class com.vaadin.featurepack.data.jpacontainer.provider.CachingMutableLocalEntityProvider
addEntity, containsEntity, flush, getAllEntityIdentifiers, getEntity, getEntityCacheMaxSize, getEntityCount, getEntityIdentifierAt, getFirstEntityIdentifier, getLastEntityIdentifier, getNextEntityIdentifier, getPreviousEntityIdentifier, isCacheEnabled, isCloneCachedEntities, refresh, refreshEntity, removeEntity, setCacheEnabled, setCloneCachedEntities, setEntityCacheMaxSize, updateEntity, updateEntityProperty, usesCacheMethods inherited from class com.vaadin.featurepack.data.jpacontainer.provider.MutableLocalEntityProvider
addListener, fireEntityProviderChangeEvent, isFireEntityProviderChangeEvent, isTransactionsHandledByProvider, removeListener, setFireEntityProviderChangeEvents, setTransactionsHandledByProviderMethods inherited from class com.vaadin.featurepack.data.jpacontainer.provider.LocalEntityProvider
addPrimaryKeyToSortList, createFilteredQuery, createSiblingQuery, createUnsortedFilteredQuery, detachEntity, doContainsEntity, doGetAllEntityIdentifiers, doGetEntity, doGetEntityCount, doGetEntityIdentifierAt, doGetEntityManager, doGetFirstEntityIdentifier, doGetLastEntityIdentifier, doGetNextEntityIdentifier, doGetPreviousEntityIdentifier, getEntityClassMetadata, getEntityManagerProvider, getIdentifier, getLazyLoadingDelegate, getQueryModifierDelegate, getSibling, readResolve, setEntitiesDetached, setEntityManager, setEntityManagerProvider, setLazyLoadingDelegate, setQueryModifierDelegate, translateSortBy, writeReplaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.featurepack.data.jpacontainer.CachingEntityProvider
setEntitiesDetachedMethods inherited from interface com.vaadin.featurepack.data.jpacontainer.EntityProvider
containsEntity, getAllEntityIdentifiers, getEntity, getEntityCount, getEntityIdentifierAt, getEntityManagerProvider, getFirstEntityIdentifier, getIdentifier, getLastEntityIdentifier, getLazyLoadingDelegate, getNextEntityIdentifier, getPreviousEntityIdentifier, getQueryModifierDelegate, refresh, refreshEntity, setEntityManager, setEntityManagerProvider, setLazyLoadingDelegate, setQueryModifierDelegateMethods inherited from interface com.vaadin.featurepack.data.jpacontainer.MutableEntityProvider
addEntity, removeEntity, updateEntity, updateEntityProperty
-
Constructor Details
-
CachingBatchableEntityProvider
-
CachingBatchableEntityProvider
-
-
Method Details
-
isEntitiesDetached
public boolean isEntitiesDetached()Description copied from interface:EntityProviderIf this method returns true, all entities returned from this entity provider are explicitly detached from the persistence context before returned, regardless of whether the persistence context is extended or transaction-scoped. Thus, no lazy-loaded associations will work and any changes made to the entities will not be reflected in the persistence context unless the entity is merged.If this method returns false, the entities returned may be managed or detached, depending on the scope of the persistence context.
The default value is implementation specific.
- Specified by:
isEntitiesDetachedin interfaceCachingEntityProvider<T>- Specified by:
isEntitiesDetachedin interfaceEntityProvider<T>- Overrides:
isEntitiesDetachedin classCachingMutableLocalEntityProvider<T>- Returns:
- true if the entities are explicitly detached, false otherwise.
- See Also:
-
runInTransaction
Description copied from class:MutableLocalEntityProviderIfMutableLocalEntityProvider.isTransactionsHandledByProvider()is true,operationwill be executed inside a transaction that is commited after the operation is completed. Otherwise,operationwill just be executed.- Overrides:
runInTransactionin classMutableLocalEntityProvider<T>- Parameters:
operation- the operation to run (must not be null).
-
getEntityManager
public jakarta.persistence.EntityManager getEntityManager()Description copied from class:LocalEntityProviderGets the entity manager. If no entity manager has been set, the one returned by the registered entity manager provider is returned.- Specified by:
getEntityManagerin interfaceEntityProvider<T>- Overrides:
getEntityManagerin classLocalEntityProvider<T>- Returns:
- the entity manager.
-
setJndiAddresses
- Specified by:
setJndiAddressesin interfaceJndiJtaProvider<T>- Parameters:
addresses- JNDI addresses that the provider should uses to lookupUserTransactionandEntityManager
-
getJndiAddresses
- Specified by:
getJndiAddressesin interfaceJndiJtaProvider<T>- Returns:
- settings that are used for JNDI lookups for
UserTransactionandEntityManager
-