public abstract class AbstractEntityManagerImpl extends java.lang.Object implements HibernateEntityManagerImplementor, java.io.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,
javax.persistence.PersistenceContextType type,
javax.persistence.SynchronizationType synchronizationType,
javax.persistence.spi.PersistenceUnitTransactionType transactionType,
java.util.Map properties) |
Modifier and Type | Method and Description |
---|---|
protected void |
applySavedSettings(NamedQueryDefinition namedQueryDefinition,
QueryImpl jpaQuery) |
protected abstract void |
checkOpen() |
void |
clear() |
boolean |
contains(java.lang.Object entity) |
java.lang.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.
|
java.lang.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.
|
java.lang.RuntimeException |
convert(java.lang.RuntimeException e) |
java.lang.RuntimeException |
convert(java.lang.RuntimeException e,
LockOptions lockOptions) |
protected QueryImpl |
createNamedJpqlQuery(NamedQueryDefinition namedQueryDefinition,
java.lang.Class resultType) |
javax.persistence.Query |
createNamedQuery(java.lang.String name) |
<T> javax.persistence.TypedQuery<T> |
createNamedQuery(java.lang.String name,
java.lang.Class<T> resultClass) |
protected QueryImpl |
createNamedSqlQuery(NamedSQLQueryDefinition namedQueryDefinition,
java.lang.Class resultType) |
javax.persistence.StoredProcedureQuery |
createNamedStoredProcedureQuery(java.lang.String name) |
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString) |
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString,
java.lang.Class resultClass) |
javax.persistence.Query |
createNativeQuery(java.lang.String sqlString,
java.lang.String resultSetMapping) |
javax.persistence.Query |
createQuery(javax.persistence.criteria.CriteriaDelete criteriaDelete) |
<T> javax.persistence.TypedQuery<T> |
createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) |
javax.persistence.Query |
createQuery(javax.persistence.criteria.CriteriaUpdate criteriaUpdate) |
javax.persistence.Query |
createQuery(java.lang.String jpaqlString) |
<T> javax.persistence.TypedQuery<T> |
createQuery(java.lang.String jpaqlString,
java.lang.Class<T> resultClass) |
<T> QueryImpl<T> |
createQuery(java.lang.String jpaqlString,
java.lang.Class<T> resultClass,
javax.persistence.criteria.Selection selection,
HibernateEntityManagerImplementor.QueryOptions queryOptions)
Used during "compiling" a JPA criteria query.
|
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName) |
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName,
java.lang.Class... resultClasses) |
javax.persistence.StoredProcedureQuery |
createStoredProcedureQuery(java.lang.String procedureName,
java.lang.String... resultSetMappings) |
protected CriteriaCompiler |
criteriaCompiler() |
void |
detach(java.lang.Object entity) |
CacheMode |
determineAppropriateLocalCacheMode(java.util.Map<java.lang.String,java.lang.Object> localProperties) |
<A> A |
find(java.lang.Class<A> entityClass,
java.lang.Object primaryKey) |
<A> A |
find(java.lang.Class<A> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockModeType) |
<A> A |
find(java.lang.Class<A> entityClass,
java.lang.Object primaryKey,
javax.persistence.LockModeType lockModeType,
java.util.Map<java.lang.String,java.lang.Object> properties) |
<T> T |
find(java.lang.Class<T> entityClass,
java.lang.Object primaryKey,
java.util.Map<java.lang.String,java.lang.Object> properties) |
void |
flush() |
javax.persistence.criteria.CriteriaBuilder |
getCriteriaBuilder() |
java.lang.Object |
getDelegate()
returns the underlying session
|
EntityManagerFactoryImpl |
getEntityManagerFactory() |
HibernateEntityManagerFactory |
getFactory()
Get access to the Hibernate extended EMF contract.
|
javax.persistence.FlushModeType |
getFlushMode()
Hibernate can be set in various flush modes that are unknown to
JPA 2.0.
|
javax.persistence.LockModeType |
getLockMode(java.lang.Object entity) |
LockOptions |
getLockRequest(javax.persistence.LockModeType lockModeType,
java.util.Map<java.lang.String,java.lang.Object> properties)
Convert from JPA 2
LockModeType & properties into LockOptions |
javax.persistence.metamodel.Metamodel |
getMetamodel() |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties() |
protected abstract Session |
getRawSession()
Deprecated.
Deprecated in favor of
getRawSession() |
<T> T |
getReference(java.lang.Class<T> entityClass,
java.lang.Object primaryKey) |
abstract Session |
getSession()
return a Session
|
javax.persistence.SynchronizationType |
getSynchronizationType() |
javax.persistence.EntityTransaction |
getTransaction() |
javax.persistence.spi.PersistenceUnitTransactionType |
getTransactionType() |
void |
handlePersistenceException(javax.persistence.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(java.lang.Object entity,
javax.persistence.LockModeType lockMode) |
void |
lock(java.lang.Object entity,
javax.persistence.LockModeType lockModeType,
java.util.Map<java.lang.String,java.lang.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(java.lang.Object entity) |
protected void |
postInit() |
void |
refresh(java.lang.Object entity) |
void |
refresh(java.lang.Object entity,
javax.persistence.LockModeType lockModeType) |
void |
refresh(java.lang.Object entity,
javax.persistence.LockModeType lockModeType,
java.util.Map<java.lang.String,java.lang.Object> properties) |
void |
refresh(java.lang.Object entity,
java.util.Map<java.lang.String,java.lang.Object> properties) |
void |
remove(java.lang.Object entity) |
protected void |
resultClassChecking(java.lang.Class resultType,
NamedSQLQueryDefinition namedQueryDefinition) |
protected void |
resultClassChecking(java.lang.Class resultClass,
Query hqlQuery) |
void |
setFlushMode(javax.persistence.FlushModeType flushModeType) |
void |
setProperty(java.lang.String s,
java.lang.Object o) |
void |
throwPersistenceException(HibernateException e)
Delegates to
HibernateEntityManagerImplementor.convert(org.hibernate.HibernateException, org.hibernate.LockOptions) and then throws the given exception. |
void |
throwPersistenceException(javax.persistence.PersistenceException e)
Delegates to
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException) and then throws the given exception. |
<T> T |
unwrap(java.lang.Class<T> clazz) |
protected QueryImpl |
wrapAsJpaQuery(NamedQueryDefinition namedQueryDefinition,
Query hibQuery) |
javax.persistence.PersistenceException |
wrapLockException(HibernateException e,
LockOptions lockOptions) |
javax.persistence.PersistenceException |
wrapStaleStateException(StaleStateException e) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkOpen
protected transient TransactionImpl tx
protected AbstractEntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory, javax.persistence.PersistenceContextType type, javax.persistence.SynchronizationType synchronizationType, javax.persistence.spi.PersistenceUnitTransactionType transactionType, java.util.Map properties)
public javax.persistence.spi.PersistenceUnitTransactionType getTransactionType()
public javax.persistence.SynchronizationType getSynchronizationType()
protected void postInit()
public javax.persistence.Query createQuery(java.lang.String jpaqlString)
createQuery
in interface javax.persistence.EntityManager
protected abstract void checkOpen()
public <T> javax.persistence.TypedQuery<T> createQuery(java.lang.String jpaqlString, java.lang.Class<T> resultClass)
createQuery
in interface javax.persistence.EntityManager
protected void resultClassChecking(java.lang.Class resultClass, Query hqlQuery)
public <T> QueryImpl<T> createQuery(java.lang.String jpaqlString, java.lang.Class<T> resultClass, javax.persistence.criteria.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> javax.persistence.TypedQuery<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
createQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createQuery(javax.persistence.criteria.CriteriaUpdate criteriaUpdate)
createQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createQuery(javax.persistence.criteria.CriteriaDelete criteriaDelete)
createQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createNamedQuery(java.lang.String name)
createNamedQuery
in interface javax.persistence.EntityManager
protected QueryImpl createNamedJpqlQuery(NamedQueryDefinition namedQueryDefinition, java.lang.Class resultType)
protected QueryImpl wrapAsJpaQuery(NamedQueryDefinition namedQueryDefinition, Query hibQuery)
protected void applySavedSettings(NamedQueryDefinition namedQueryDefinition, QueryImpl jpaQuery)
protected QueryImpl createNamedSqlQuery(NamedSQLQueryDefinition namedQueryDefinition, java.lang.Class resultType)
protected void resultClassChecking(java.lang.Class resultType, NamedSQLQueryDefinition namedQueryDefinition)
public <T> javax.persistence.TypedQuery<T> createNamedQuery(java.lang.String name, java.lang.Class<T> resultClass)
createNamedQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createNativeQuery(java.lang.String sqlString)
createNativeQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass)
createNativeQuery
in interface javax.persistence.EntityManager
public javax.persistence.Query createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)
createNativeQuery
in interface javax.persistence.EntityManager
public javax.persistence.StoredProcedureQuery createNamedStoredProcedureQuery(java.lang.String name)
createNamedStoredProcedureQuery
in interface javax.persistence.EntityManager
public javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName)
createStoredProcedureQuery
in interface javax.persistence.EntityManager
public javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.Class... resultClasses)
createStoredProcedureQuery
in interface javax.persistence.EntityManager
public javax.persistence.StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.String... resultSetMappings)
createStoredProcedureQuery
in interface javax.persistence.EntityManager
public <T> T getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
getReference
in interface javax.persistence.EntityManager
public <A> A find(java.lang.Class<A> entityClass, java.lang.Object primaryKey)
find
in interface javax.persistence.EntityManager
public <T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, java.util.Map<java.lang.String,java.lang.Object> properties)
find
in interface javax.persistence.EntityManager
public <A> A find(java.lang.Class<A> entityClass, java.lang.Object primaryKey, javax.persistence.LockModeType lockModeType)
find
in interface javax.persistence.EntityManager
public <A> A find(java.lang.Class<A> entityClass, java.lang.Object primaryKey, javax.persistence.LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
find
in interface javax.persistence.EntityManager
public CacheMode determineAppropriateLocalCacheMode(java.util.Map<java.lang.String,java.lang.Object> localProperties)
public void persist(java.lang.Object entity)
persist
in interface javax.persistence.EntityManager
public <A> A merge(A entity)
merge
in interface javax.persistence.EntityManager
public void remove(java.lang.Object entity)
remove
in interface javax.persistence.EntityManager
public void refresh(java.lang.Object entity)
refresh
in interface javax.persistence.EntityManager
public void refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties)
refresh
in interface javax.persistence.EntityManager
public void refresh(java.lang.Object entity, javax.persistence.LockModeType lockModeType)
refresh
in interface javax.persistence.EntityManager
public void refresh(java.lang.Object entity, javax.persistence.LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
refresh
in interface javax.persistence.EntityManager
public boolean contains(java.lang.Object entity)
contains
in interface javax.persistence.EntityManager
public javax.persistence.LockModeType getLockMode(java.lang.Object entity)
getLockMode
in interface javax.persistence.EntityManager
public void setProperty(java.lang.String s, java.lang.Object o)
setProperty
in interface javax.persistence.EntityManager
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
getProperties
in interface javax.persistence.EntityManager
public void flush()
flush
in interface javax.persistence.EntityManager
public abstract Session getSession()
getSession
in interface HibernateEntityManager
java.lang.IllegalStateException
- if the entity manager is closed@Deprecated protected abstract Session getRawSession()
getRawSession()
protected abstract Session internalGetSession()
public javax.persistence.EntityTransaction getTransaction()
getTransaction
in interface javax.persistence.EntityManager
public EntityManagerFactoryImpl getEntityManagerFactory()
getEntityManagerFactory
in interface javax.persistence.EntityManager
protected EntityManagerFactoryImpl internalGetEntityManagerFactory()
public HibernateEntityManagerFactory getFactory()
HibernateEntityManagerFactoryAware
getFactory
in interface HibernateEntityManagerFactoryAware
public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
getCriteriaBuilder
in interface javax.persistence.EntityManager
public javax.persistence.metamodel.Metamodel getMetamodel()
getMetamodel
in interface javax.persistence.EntityManager
public void setFlushMode(javax.persistence.FlushModeType flushModeType)
setFlushMode
in interface javax.persistence.EntityManager
public void clear()
clear
in interface javax.persistence.EntityManager
public void detach(java.lang.Object entity)
detach
in interface javax.persistence.EntityManager
public javax.persistence.FlushModeType getFlushMode()
getFlushMode
in interface javax.persistence.EntityManager
public void lock(java.lang.Object entity, javax.persistence.LockModeType lockMode)
lock
in interface javax.persistence.EntityManager
public void lock(java.lang.Object entity, javax.persistence.LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
lock
in interface javax.persistence.EntityManager
public LockOptions getLockRequest(javax.persistence.LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.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(java.lang.Class<T> clazz)
unwrap
in interface javax.persistence.EntityManager
public void markForRollbackOnly()
HibernateEntityManagerImplementor
markForRollbackOnly
in interface HibernateEntityManagerImplementor
public boolean isJoinedToTransaction()
isJoinedToTransaction
in interface javax.persistence.EntityManager
public void joinTransaction()
joinTransaction
in interface javax.persistence.EntityManager
public java.lang.Object getDelegate()
getDelegate
in interface javax.persistence.EntityManager
public void handlePersistenceException(javax.persistence.PersistenceException e)
HibernateEntityManagerImplementor
handlePersistenceException
in interface HibernateEntityManagerImplementor
e
- The exception being handled.public void throwPersistenceException(javax.persistence.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 java.lang.RuntimeException convert(HibernateException e)
HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.handlePersistenceException(javax.persistence.PersistenceException)
are also made.convert
in interface HibernateEntityManagerImplementor
e
- The Hibernate excepton.public java.lang.RuntimeException convert(java.lang.RuntimeException e)
public java.lang.RuntimeException convert(java.lang.RuntimeException e, LockOptions lockOptions)
public java.lang.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 javax.persistence.PersistenceException wrapStaleStateException(StaleStateException e)
wrapStaleStateException
in interface HibernateEntityManagerImplementor
public javax.persistence.PersistenceException wrapLockException(HibernateException e, LockOptions lockOptions)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.