public class EntityManagerImpl extends AbstractEntityManagerImpl implements SessionOwner
EntityManager
.AbstractEntityManagerImpl.TupleBuilderTransformer
HibernateEntityManagerImplementor.QueryOptions
Modifier and Type | Field and Description |
---|---|
protected boolean |
discardOnClose |
static EntityManagerMessageLogger |
LOG |
protected boolean |
open |
protected Session |
session |
tx
Constructor and Description |
---|
EntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory,
PersistenceContextType pcType,
SynchronizationType synchronizationType,
PersistenceUnitTransactionType transactionType,
boolean discardOnClose,
Class sessionInterceptorClass,
Map properties) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkOpen() |
void |
checkOpen(boolean markForRollbackIfClosed)
Used to ensure the EntityManager is open, throwing IllegalStateException if it is closed.
|
void |
close()
Close an application-managed entity manager.
|
<T> EntityGraph<T> |
createEntityGraph(Class<T> rootType)
Return a mutable EntityGraph that can be used to dynamically create an EntityGraph.
|
EntityGraph<?> |
createEntityGraph(String graphName)
Return a mutable copy of the named EntityGraph.
|
AfterCompletionAction |
getAfterCompletionAction() |
EntityGraph<?> |
getEntityGraph(String graphName)
Return a named EntityGraph.
|
<T> List<EntityGraph<? super T>> |
getEntityGraphs(Class<T> entityClass)
Return all named EntityGraphs that have been defined for the provided class type.
|
ExceptionMapper |
getExceptionMapper() |
ManagedFlushChecker |
getManagedFlushChecker() |
protected Session |
getRawSession()
Return a Session (even if the entity manager is closed).
|
Session |
getSession()
return a Session
|
protected Session |
internalGetSession()
Return a Session without any validation checks.
|
boolean |
isOpen()
Determine whether the entity manager is open.
|
boolean |
shouldAutoCloseSession()
Should session automatically be closed after transaction completion?
|
applySavedSettings, clear, contains, convert, convert, convert, convert, createNamedJpqlQuery, createNamedQuery, createNamedQuery, createNamedSqlQuery, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, criteriaCompiler, detach, determineAppropriateLocalCacheMode, find, find, find, find, flush, getCriteriaBuilder, getDelegate, getEntityManagerFactory, getFactory, getFlushMode, getLockMode, getLockRequest, getMetamodel, getProperties, getReference, getSynchronizationType, getTransaction, getTransactionType, handlePersistenceException, internalGetEntityManagerFactory, isJoinedToTransaction, isTransactionInProgress, joinTransaction, lock, lock, markForRollbackOnly, merge, persist, postInit, refresh, refresh, refresh, refresh, remove, resultClassChecking, resultClassChecking, setFlushMode, setProperty, throwPersistenceException, throwPersistenceException, unwrap, wrapAsJpaQuery, wrapLockException, wrapStaleStateException
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convert, convert, createQuery, getLockRequest, handlePersistenceException, isTransactionInProgress, markForRollbackOnly, throwPersistenceException, throwPersistenceException, wrapStaleStateException
getFactory
clear, contains, createNamedQuery, createNamedQuery, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, detach, find, find, find, find, flush, getCriteriaBuilder, getDelegate, getEntityManagerFactory, getFlushMode, getLockMode, getMetamodel, getProperties, getReference, getTransaction, isJoinedToTransaction, joinTransaction, lock, lock, merge, persist, refresh, refresh, refresh, refresh, remove, setFlushMode, setProperty, unwrap
public static final EntityManagerMessageLogger LOG
protected Session session
protected boolean open
protected boolean discardOnClose
public EntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory, PersistenceContextType pcType, SynchronizationType synchronizationType, PersistenceUnitTransactionType transactionType, boolean discardOnClose, Class sessionInterceptorClass, Map properties)
protected void checkOpen()
checkOpen
in class AbstractEntityManagerImpl
public void checkOpen(boolean markForRollbackIfClosed)
HibernateEntityManagerImplementor
markForRollbackIfClosed
, may also rollback any enlisted-in transaction. This
distinction is made across various sections of the spec. Most failed checks should rollback. Section
3.10.7 (per 2.1 spec) lists cases related to calls on related query objects that should not rollback.checkOpen
in interface HibernateEntityManagerImplementor
markForRollbackIfClosed
- If the EM is closed, should the transaction (if one) be marked for rollback?public Session getSession()
AbstractEntityManagerImpl
getSession
in interface HibernateEntityManager
getSession
in class AbstractEntityManagerImpl
protected Session getRawSession()
AbstractEntityManagerImpl
getRawSession
in class AbstractEntityManagerImpl
protected Session internalGetSession()
AbstractEntityManagerImpl
internalGetSession
in class AbstractEntityManagerImpl
public void close()
EntityManager
EntityManager
instance and any
Query
and TypedQuery
objects obtained from it will throw the IllegalStateException
except for getProperties
,
getTransaction
, and isOpen
(which will return false).
If this method is called when the entity manager is
associated with an active transaction, the persistence
context remains managed until the transaction completes.close
in interface EntityManager
public boolean isOpen()
EntityManager
isOpen
in interface EntityManager
public <T> EntityGraph<T> createEntityGraph(Class<T> rootType)
EntityManager
createEntityGraph
in interface EntityManager
rootType
- class of entity graphpublic EntityGraph<?> createEntityGraph(String graphName)
EntityManager
createEntityGraph
in interface EntityManager
graphName
- name of an entity graphpublic EntityGraph<?> getEntityGraph(String graphName)
EntityManager
getEntityGraph
in interface EntityManager
graphName
- name of an existing entity graphpublic <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass)
EntityManager
getEntityGraphs
in interface EntityManager
entityClass
- entity classpublic boolean shouldAutoCloseSession()
SessionOwner
shouldAutoCloseSession
in interface SessionOwner
public ExceptionMapper getExceptionMapper()
getExceptionMapper
in interface SessionOwner
public AfterCompletionAction getAfterCompletionAction()
getAfterCompletionAction
in interface SessionOwner
public ManagedFlushChecker getManagedFlushChecker()
getManagedFlushChecker
in interface SessionOwner
Copyright © 2016 JBoss by Red Hat. All rights reserved.