public abstract class AbstractEntityManagerImpl extends Object implements HibernateEntityManagerImplementor, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AbstractEntityManagerImpl.TupleBuilderTransformer |
HibernateEntityManagerImplementor.QueryOptions
Modifier and Type | Field and Description |
---|---|
protected TransactionImpl |
tx |
Modifier | Constructor and Description |
---|---|
protected |
AbstractEntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory,
PersistenceContextType type,
SynchronizationType synchronizationType,
PersistenceUnitTransactionType transactionType,
Map properties) |
Modifier and Type | Method and Description |
---|---|
protected void |
applySavedSettings(NamedQueryDefinition namedQueryDefinition,
QueryImpl jpaQuery) |
protected abstract void |
checkOpen() |
void |
clear() |
boolean |
contains(Object entity) |
RuntimeException |
convert(HibernateException e)
Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use
of exceptions outside its exception hierarchy, though they are all runtime exceptions.
|
RuntimeException |
convert(HibernateException e,
LockOptions lockOptions)
Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use
of exceptions outside its exception hierarchy, though they are all runtime exceptions.
|
RuntimeException |
convert(RuntimeException e) |
RuntimeException |
convert(RuntimeException e,
LockOptions lockOptions) |
protected QueryImpl |
createNamedJpqlQuery(NamedQueryDefinition namedQueryDefinition,
Class resultType) |
Query |
createNamedQuery(String name) |
<T> TypedQuery<T> |
createNamedQuery(String name,
Class<T> resultClass) |
protected QueryImpl |
createNamedSqlQuery(NamedSQLQueryDefinition namedQueryDefinition,
Class resultType) |
StoredProcedureQuery |
createNamedStoredProcedureQuery(String name) |
Query |
createNativeQuery(String sqlString) |
Query |
createNativeQuery(String sqlString,
Class resultClass) |
Query |
createNativeQuery(String sqlString,
String resultSetMapping) |
Query |
createQuery(CriteriaDelete criteriaDelete) |
<T> TypedQuery<T> |
createQuery(CriteriaQuery<T> criteriaQuery) |
Query |
createQuery(CriteriaUpdate criteriaUpdate) |
Query |
createQuery(String jpaqlString) |
<T> TypedQuery<T> |
createQuery(String jpaqlString,
Class<T> resultClass) |
<T> QueryImpl<T> |
createQuery(String jpaqlString,
Class<T> resultClass,
Selection selection,
HibernateEntityManagerImplementor.QueryOptions queryOptions)
Used during "compiling" a JPA criteria query.
|
StoredProcedureQuery |
createStoredProcedureQuery(String procedureName) |
StoredProcedureQuery |
createStoredProcedureQuery(String procedureName,
Class... resultClasses) |
StoredProcedureQuery |
createStoredProcedureQuery(String procedureName,
String... resultSetMappings) |
protected CriteriaCompiler |
criteriaCompiler() |
void |
detach(Object entity) |
CacheMode |
determineAppropriateLocalCacheMode(Map<String,Object> localProperties) |
<A> A |
find(Class<A> entityClass,
Object primaryKey) |
<A> A |
find(Class<A> entityClass,
Object primaryKey,
LockModeType lockModeType) |
<A> A |
find(Class<A> entityClass,
Object primaryKey,
LockModeType lockModeType,
Map<String,Object> properties) |
<T> T |
find(Class<T> entityClass,
Object primaryKey,
Map<String,Object> properties) |
void |
flush() |
CriteriaBuilder |
getCriteriaBuilder() |
Object |
getDelegate()
returns the underlying session
|
EntityManagerFactoryImpl |
getEntityManagerFactory() |
HibernateEntityManagerFactory |
getFactory()
Get access to the Hibernate extended EMF contract.
|
FlushModeType |
getFlushMode()
Hibernate can be set in various flush modes that are unknown to
JPA 2.0.
|
LockModeType |
getLockMode(Object entity) |
LockOptions |
getLockRequest(LockModeType lockModeType,
Map<String,Object> properties)
Convert from JPA 2
LockModeType & properties into LockOptions |
Metamodel |
getMetamodel() |
Map<String,Object> |
getProperties() |
protected abstract Session |
getRawSession()
Deprecated.
Deprecated in favor of
getRawSession() |
<T> T |
getReference(Class<T> entityClass,
Object primaryKey) |
abstract Session |
getSession()
return a Session
|
SynchronizationType |
getSynchronizationType() |
EntityTransaction |
getTransaction() |
PersistenceUnitTransactionType |
getTransactionType() |
void |
handlePersistenceException(PersistenceException e)
Handles marking for rollback and other such operations that need to occur depending on the type of
exception being handled.
|
protected EntityManagerFactoryImpl |
internalGetEntityManagerFactory() |
protected abstract Session |
internalGetSession()
Return a Session without any validation checks.
|
boolean |
isJoinedToTransaction() |
boolean |
isTransactionInProgress()
Provides access to whether a transaction is currently in progress.
|
void |
joinTransaction() |
void |
lock(Object entity,
LockModeType lockMode) |
void |
lock(Object entity,
LockModeType lockModeType,
Map<String,Object> properties) |
void |
markForRollbackOnly()
Used to mark a transaction for rollback only (when that is the JPA spec defined behavior).
|
<A> A |
merge(A entity) |
void |
persist(Object entity) |
protected void |
postInit() |
void |
refresh(Object entity) |
void |
refresh(Object entity,
LockModeType lockModeType) |
void |
refresh(Object entity,
LockModeType lockModeType,
Map<String,Object> properties) |
void |
refresh(Object entity,
Map<String,Object> properties) |
void |
remove(Object entity) |
protected void |
resultClassChecking(Class resultType,
NamedSQLQueryDefinition namedQueryDefinition) |
protected void |
resultClassChecking(Class resultClass,
Query hqlQuery) |
void |
setFlushMode(FlushModeType flushModeType) |
void |
setProperty(String s,
Object o) |
void |
throwPersistenceException(HibernateException e)
Delegates to
HibernateEntityManagerImplementor.convert(org.hibernate.HibernateException, org.hibernate.LockOptions) and then throws the given exception. |
void |
throwPersistenceException(PersistenceException e)
Delegates to
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException) and then throws the given exception. |
<T> T |
unwrap(Class<T> clazz) |
protected QueryImpl |
wrapAsJpaQuery(NamedQueryDefinition namedQueryDefinition,
Query hibQuery) |
PersistenceException |
wrapLockException(HibernateException e,
LockOptions lockOptions) |
PersistenceException |
wrapStaleStateException(StaleStateException e) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkOpen
close, createEntityGraph, createEntityGraph, getEntityGraph, getEntityGraphs, isOpen
protected transient TransactionImpl tx
protected AbstractEntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory, PersistenceContextType type, SynchronizationType synchronizationType, PersistenceUnitTransactionType transactionType, Map properties)
public PersistenceUnitTransactionType getTransactionType()
public SynchronizationType getSynchronizationType()
protected void postInit()
public Query createQuery(String jpaqlString)
createQuery
in interface EntityManager
protected abstract void checkOpen()
public <T> TypedQuery<T> createQuery(String jpaqlString, Class<T> resultClass)
createQuery
in interface EntityManager
public <T> QueryImpl<T> createQuery(String jpaqlString, Class<T> resultClass, Selection selection, HibernateEntityManagerImplementor.QueryOptions queryOptions)
HibernateEntityManagerImplementor
createQuery
in interface HibernateEntityManagerImplementor
T
- The query typejpaqlString
- The criteria query rendered as a JPA QL stringresultClass
- The result type (the type expected in the result list)selection
- The selection(s)queryOptions
- The options to use to build the query.protected CriteriaCompiler criteriaCompiler()
public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery)
createQuery
in interface EntityManager
public Query createQuery(CriteriaUpdate criteriaUpdate)
createQuery
in interface EntityManager
public Query createQuery(CriteriaDelete criteriaDelete)
createQuery
in interface EntityManager
public Query createNamedQuery(String name)
createNamedQuery
in interface EntityManager
protected QueryImpl createNamedJpqlQuery(NamedQueryDefinition namedQueryDefinition, Class resultType)
protected QueryImpl wrapAsJpaQuery(NamedQueryDefinition namedQueryDefinition, Query hibQuery)
protected void applySavedSettings(NamedQueryDefinition namedQueryDefinition, QueryImpl jpaQuery)
protected QueryImpl createNamedSqlQuery(NamedSQLQueryDefinition namedQueryDefinition, Class resultType)
protected void resultClassChecking(Class resultType, NamedSQLQueryDefinition namedQueryDefinition)
public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass)
createNamedQuery
in interface EntityManager
public Query createNativeQuery(String sqlString)
createNativeQuery
in interface EntityManager
public Query createNativeQuery(String sqlString, Class resultClass)
createNativeQuery
in interface EntityManager
public Query createNativeQuery(String sqlString, String resultSetMapping)
createNativeQuery
in interface EntityManager
public StoredProcedureQuery createNamedStoredProcedureQuery(String name)
createNamedStoredProcedureQuery
in interface EntityManager
public StoredProcedureQuery createStoredProcedureQuery(String procedureName)
createStoredProcedureQuery
in interface EntityManager
public StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses)
createStoredProcedureQuery
in interface EntityManager
public StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings)
createStoredProcedureQuery
in interface EntityManager
public <T> T getReference(Class<T> entityClass, Object primaryKey)
getReference
in interface EntityManager
public <A> A find(Class<A> entityClass, Object primaryKey)
find
in interface EntityManager
public <T> T find(Class<T> entityClass, Object primaryKey, Map<String,Object> properties)
find
in interface EntityManager
public <A> A find(Class<A> entityClass, Object primaryKey, LockModeType lockModeType)
find
in interface EntityManager
public <A> A find(Class<A> entityClass, Object primaryKey, LockModeType lockModeType, Map<String,Object> properties)
find
in interface EntityManager
public CacheMode determineAppropriateLocalCacheMode(Map<String,Object> localProperties)
public void persist(Object entity)
persist
in interface EntityManager
public <A> A merge(A entity)
merge
in interface EntityManager
public void remove(Object entity)
remove
in interface EntityManager
public void refresh(Object entity)
refresh
in interface EntityManager
public void refresh(Object entity, Map<String,Object> properties)
refresh
in interface EntityManager
public void refresh(Object entity, LockModeType lockModeType)
refresh
in interface EntityManager
public void refresh(Object entity, LockModeType lockModeType, Map<String,Object> properties)
refresh
in interface EntityManager
public boolean contains(Object entity)
contains
in interface EntityManager
public LockModeType getLockMode(Object entity)
getLockMode
in interface EntityManager
public void setProperty(String s, Object o)
setProperty
in interface EntityManager
public Map<String,Object> getProperties()
getProperties
in interface EntityManager
public void flush()
flush
in interface EntityManager
public abstract Session getSession()
getSession
in interface HibernateEntityManager
IllegalStateException
- if the entity manager is closed@Deprecated protected abstract Session getRawSession()
getRawSession()
protected abstract Session internalGetSession()
public EntityTransaction getTransaction()
getTransaction
in interface EntityManager
public EntityManagerFactoryImpl getEntityManagerFactory()
getEntityManagerFactory
in interface EntityManager
protected EntityManagerFactoryImpl internalGetEntityManagerFactory()
public HibernateEntityManagerFactory getFactory()
HibernateEntityManagerFactoryAware
getFactory
in interface HibernateEntityManagerFactoryAware
public CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder
in interface EntityManager
public Metamodel getMetamodel()
getMetamodel
in interface EntityManager
public void setFlushMode(FlushModeType flushModeType)
setFlushMode
in interface EntityManager
public void clear()
clear
in interface EntityManager
public void detach(Object entity)
detach
in interface EntityManager
public FlushModeType getFlushMode()
getFlushMode
in interface EntityManager
public void lock(Object entity, LockModeType lockMode)
lock
in interface EntityManager
public void lock(Object entity, LockModeType lockModeType, Map<String,Object> properties)
lock
in interface EntityManager
public LockOptions getLockRequest(LockModeType lockModeType, Map<String,Object> properties)
HibernateEntityManagerImplementor
LockModeType
& properties into LockOptions
getLockRequest
in interface HibernateEntityManagerImplementor
lockModeType
- is the requested lock typeproperties
- are the lock propertiespublic boolean isTransactionInProgress()
HibernateEntityManagerImplementor
isTransactionInProgress
in interface HibernateEntityManagerImplementor
public <T> T unwrap(Class<T> clazz)
unwrap
in interface EntityManager
public void markForRollbackOnly()
HibernateEntityManagerImplementor
markForRollbackOnly
in interface HibernateEntityManagerImplementor
public boolean isJoinedToTransaction()
isJoinedToTransaction
in interface EntityManager
public void joinTransaction()
joinTransaction
in interface EntityManager
public Object getDelegate()
getDelegate
in interface EntityManager
public void handlePersistenceException(PersistenceException e)
HibernateEntityManagerImplementor
handlePersistenceException
in interface HibernateEntityManagerImplementor
e
- The exception being handled.public void throwPersistenceException(PersistenceException e)
HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException)
and then throws the given exception.throwPersistenceException
in interface HibernateEntityManagerImplementor
e
- The exception being handled and finally thrown.public RuntimeException convert(HibernateException e)
HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException)
are also made.convert
in interface HibernateEntityManagerImplementor
e
- The Hibernate excepton.public RuntimeException convert(RuntimeException e)
public RuntimeException convert(RuntimeException e, LockOptions lockOptions)
public RuntimeException convert(HibernateException e, LockOptions lockOptions)
HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException)
are also made.convert
in interface HibernateEntityManagerImplementor
e
- The Hibernate excepton.lockOptions
- The lock options in effect at the time of exception (can be null)public void throwPersistenceException(HibernateException e)
HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.convert(org.hibernate.HibernateException, org.hibernate.LockOptions)
and then throws the given exception.throwPersistenceException
in interface HibernateEntityManagerImplementor
e
- The exception being handled and finally thrown.public PersistenceException wrapStaleStateException(StaleStateException e)
wrapStaleStateException
in interface HibernateEntityManagerImplementor
public PersistenceException wrapLockException(HibernateException e, LockOptions lockOptions)
Copyright © 2001-2017 Red Hat, Inc. All Rights Reserved.