org.hibernate.ejb
Interface HibernateEntityManagerImplementor

All Superinterfaces:
EntityManager, HibernateEntityManager
All Known Implementing Classes:
AbstractEntityManagerImpl, CurrentEntityManagerImpl, EntityManagerImpl

public interface HibernateEntityManagerImplementor
extends HibernateEntityManager

Additional internal contracts for the Hibernate EntityManager implementation.

Author:
Emmanuel Bernard, Steve Ebersole

Nested Class Summary
static interface HibernateEntityManagerImplementor.Options
           
 
Method Summary
 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.
<T> TypedQuery<T>
createQuery(String jpaqlString, Class<T> resultClass, javax.persistence.criteria.Selection selection, HibernateEntityManagerImplementor.Options options)
          Used during "compiling" a JPA criteria query.
 HibernateEntityManagerFactory getFactory()
          Get access to the Hibernate extended EMF contract.
 LockOptions getLockRequest(LockModeType lockModeType, Map<String,Object> properties)
          Convert from JPA 2 LockModeType & properties into LockOptions
 void handlePersistenceException(PersistenceException e)
          Handles marking for rollback and other such operations that need to occur depending on the type of exception being handled.
 boolean isTransactionInProgress()
          Provides access to whether a transaction is currently in progress.
 void throwPersistenceException(HibernateException e)
          Delegates to convert(org.hibernate.HibernateException, org.hibernate.LockOptions) and then throws the given exception.
 void throwPersistenceException(PersistenceException e)
          Delegates to handlePersistenceException(javax.persistence.PersistenceException) and then throws the given exception.
 PersistenceException wrapStaleStateException(StaleStateException e)
           
 
Methods inherited from interface org.hibernate.ejb.HibernateEntityManager
getSession
 
Methods inherited from interface javax.persistence.EntityManager
clear, close, contains, createNamedQuery, createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, detach, find, find, find, find, flush, getCriteriaBuilder, getDelegate, getEntityManagerFactory, getFlushMode, getLockMode, getMetamodel, getProperties, getReference, getTransaction, isOpen, joinTransaction, lock, lock, merge, persist, refresh, refresh, refresh, refresh, remove, setFlushMode, setProperty, unwrap
 

Method Detail

getFactory

HibernateEntityManagerFactory getFactory()
Get access to the Hibernate extended EMF contract.

Returns:
The Hibernate EMF contract for this EM.

isTransactionInProgress

boolean isTransactionInProgress()
Provides access to whether a transaction is currently in progress.

Returns:
True if a transaction is considered currently in progress; false otherwise.

handlePersistenceException

void handlePersistenceException(PersistenceException e)
Handles marking for rollback and other such operations that need to occur depending on the type of exception being handled.

Parameters:
e - The exception being handled.

throwPersistenceException

void throwPersistenceException(PersistenceException e)
Delegates to handlePersistenceException(javax.persistence.PersistenceException) and then throws the given exception.

Parameters:
e - The exception being handled and finally thrown.

convert

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.

Any appropriate/needed calls to handlePersistenceException(javax.persistence.PersistenceException) are also made.

Parameters:
e - The Hibernate excepton.
lockOptions - The lock options in effect at the time of exception (can be null)
Returns:
The JPA-specified exception

convert

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.

Any appropriate/needed calls to handlePersistenceException(javax.persistence.PersistenceException) are also made.

Parameters:
e - The Hibernate excepton.
Returns:
The JPA-specified exception

throwPersistenceException

void throwPersistenceException(HibernateException e)
Delegates to convert(org.hibernate.HibernateException, org.hibernate.LockOptions) and then throws the given exception.

Parameters:
e - The exception being handled and finally thrown.

wrapStaleStateException

PersistenceException wrapStaleStateException(StaleStateException e)

getLockRequest

LockOptions getLockRequest(LockModeType lockModeType,
                           Map<String,Object> properties)
Convert from JPA 2 LockModeType & properties into LockOptions

Parameters:
lockModeType - is the requested lock type
properties - are the lock properties
Returns:
the LockOptions

createQuery

<T> TypedQuery<T> createQuery(String jpaqlString,
                              Class<T> resultClass,
                              javax.persistence.criteria.Selection selection,
                              HibernateEntityManagerImplementor.Options options)
Used during "compiling" a JPA criteria query.

Type Parameters:
T - The query type
Parameters:
jpaqlString - The criteria query rendered as a JPA QL string
resultClass - The result type (the type expected in the result list)
selection - The selection(s)
options - The options to use to build the query.
Returns:
The typed query


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.