Class EntityProvider<T>
java.lang.Object
com.vaadin.featurepack.data.jpacontainer.provider.LocalEntityProvider<T>
com.vaadin.featurepack.data.jpacontainer.provider.jndijta.EntityProvider<T>
- Type Parameters:
T-
- All Implemented Interfaces:
EntityProvider<T>,JndiJtaProvider<T>,Serializable
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:
-
Constructor Summary
ConstructorsConstructorDescriptionEntityProvider(Class<T> entityClass) EntityProvider(Class<T> entityClass, JndiAddresses jndiAddresses) -
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.voidsetJndiAddresses(JndiAddresses addresses) Methods inherited from class com.vaadin.featurepack.data.jpacontainer.provider.LocalEntityProvider
addPrimaryKeyToSortList, containsEntity, createFilteredQuery, createSiblingQuery, createUnsortedFilteredQuery, detachEntity, doContainsEntity, doGetAllEntityIdentifiers, doGetEntity, doGetEntityCount, doGetEntityIdentifierAt, doGetEntityManager, doGetFirstEntityIdentifier, doGetLastEntityIdentifier, doGetNextEntityIdentifier, doGetPreviousEntityIdentifier, getAllEntityIdentifiers, getEntity, getEntityClassMetadata, getEntityCount, getEntityIdentifierAt, getEntityManagerProvider, getFirstEntityIdentifier, getIdentifier, getLastEntityIdentifier, getLazyLoadingDelegate, getNextEntityIdentifier, getPreviousEntityIdentifier, getQueryModifierDelegate, getSibling, readResolve, refresh, refreshEntity, 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.EntityProvider
containsEntity, getAllEntityIdentifiers, getEntity, getEntityCount, getEntityIdentifierAt, getEntityManagerProvider, getFirstEntityIdentifier, getIdentifier, getLastEntityIdentifier, getLazyLoadingDelegate, getNextEntityIdentifier, getPreviousEntityIdentifier, getQueryModifierDelegate, refresh, refreshEntity, setEntitiesDetached, setEntityManager, setEntityManagerProvider, setLazyLoadingDelegate, setQueryModifierDelegate
-
Constructor Details
-
EntityProvider
-
EntityProvider
-
-
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 interfaceEntityProvider<T>- Overrides:
isEntitiesDetachedin classLocalEntityProvider<T>- Returns:
- true if the entities are explicitly detached, false otherwise.
- See Also:
-
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
-