org.hibernate.ejb
Class AbstractEntityManagerImpl

java.lang.Object
  extended by org.hibernate.ejb.AbstractEntityManagerImpl
All Implemented Interfaces:
Serializable, javax.persistence.EntityManager, HibernateEntityManager, HibernateEntityManagerImplementor
Direct Known Subclasses:
CurrentEntityManagerImpl, EntityManagerImpl

public abstract class AbstractEntityManagerImpl
extends Object
implements HibernateEntityManagerImplementor, Serializable

Author:
Gavin King, Emmanuel Bernard
See Also:
Serialized Form

Field Summary
protected  javax.persistence.PersistenceContextType persistenceContextType
           
protected  TransactionImpl tx
           
 
Constructor Summary
protected AbstractEntityManagerImpl(javax.persistence.PersistenceContextType type, javax.persistence.spi.PersistenceUnitTransactionType transactionType, Map properties)
           
 
Method Summary
 void clear()
           
 boolean contains(Object entity)
           
 javax.persistence.Query createNamedQuery(String name)
           
 javax.persistence.Query createNativeQuery(String sqlString)
           
 javax.persistence.Query createNativeQuery(String sqlString, Class resultClass)
           
 javax.persistence.Query createNativeQuery(String sqlString, String resultSetMapping)
           
 javax.persistence.Query createQuery(String ejbqlString)
           
<A> A
find(Class<A> entityClass, Object primaryKey)
           
 void flush()
           
 Object getDelegate()
          returns the underlying session
 javax.persistence.FlushModeType getFlushMode()
           
protected abstract  org.hibernate.Session getRawSession()
          Return a Session (even if the entity manager is closed
<T> T
getReference(Class<T> entityClass, Object primaryKey)
           
abstract  org.hibernate.Session getSession()
          return a Session
 javax.persistence.EntityTransaction getTransaction()
           
 boolean isTransactionInProgress()
           
 void joinTransaction()
           
 void lock(Object entity, javax.persistence.LockModeType lockMode)
           
protected  void markAsRollback()
           
<A> A
merge(A entity)
           
 void persist(Object entity)
           
protected  void postInit()
           
 void refresh(Object entity)
           
 void remove(Object entity)
           
 void setFlushMode(javax.persistence.FlushModeType flushModeType)
           
 void throwPersistenceException(org.hibernate.HibernateException e)
           
 void throwPersistenceException(javax.persistence.PersistenceException e)
           
 javax.persistence.PersistenceException wrapStaleStateException(org.hibernate.StaleStateException e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.persistence.EntityManager
close, isOpen
 

Field Detail

tx

protected transient TransactionImpl tx

persistenceContextType

protected javax.persistence.PersistenceContextType persistenceContextType
Constructor Detail

AbstractEntityManagerImpl

protected AbstractEntityManagerImpl(javax.persistence.PersistenceContextType type,
                                    javax.persistence.spi.PersistenceUnitTransactionType transactionType,
                                    Map properties)
Method Detail

postInit

protected void postInit()

createQuery

public javax.persistence.Query createQuery(String ejbqlString)
Specified by:
createQuery in interface javax.persistence.EntityManager

createNamedQuery

public javax.persistence.Query createNamedQuery(String name)
Specified by:
createNamedQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString,
                                                 Class resultClass)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

createNativeQuery

public javax.persistence.Query createNativeQuery(String sqlString,
                                                 String resultSetMapping)
Specified by:
createNativeQuery in interface javax.persistence.EntityManager

getReference

public <T> T getReference(Class<T> entityClass,
                          Object primaryKey)
Specified by:
getReference in interface javax.persistence.EntityManager

find

public <A> A find(Class<A> entityClass,
                  Object primaryKey)
Specified by:
find in interface javax.persistence.EntityManager

persist

public void persist(Object entity)
Specified by:
persist in interface javax.persistence.EntityManager

merge

public <A> A merge(A entity)
Specified by:
merge in interface javax.persistence.EntityManager

remove

public void remove(Object entity)
Specified by:
remove in interface javax.persistence.EntityManager

refresh

public void refresh(Object entity)
Specified by:
refresh in interface javax.persistence.EntityManager

contains

public boolean contains(Object entity)
Specified by:
contains in interface javax.persistence.EntityManager

flush

public void flush()
Specified by:
flush in interface javax.persistence.EntityManager

getSession

public abstract org.hibernate.Session getSession()
return a Session

Specified by:
getSession in interface HibernateEntityManager
Throws:
IllegalStateException - if the entity manager is closed

getRawSession

protected abstract org.hibernate.Session getRawSession()
Return a Session (even if the entity manager is closed


getTransaction

public javax.persistence.EntityTransaction getTransaction()
Specified by:
getTransaction in interface javax.persistence.EntityManager

setFlushMode

public void setFlushMode(javax.persistence.FlushModeType flushModeType)
Specified by:
setFlushMode in interface javax.persistence.EntityManager

clear

public void clear()
Specified by:
clear in interface javax.persistence.EntityManager

getFlushMode

public javax.persistence.FlushModeType getFlushMode()
Specified by:
getFlushMode in interface javax.persistence.EntityManager

lock

public void lock(Object entity,
                 javax.persistence.LockModeType lockMode)
Specified by:
lock in interface javax.persistence.EntityManager

isTransactionInProgress

public boolean isTransactionInProgress()
Specified by:
isTransactionInProgress in interface HibernateEntityManagerImplementor

markAsRollback

protected void markAsRollback()

joinTransaction

public void joinTransaction()
Specified by:
joinTransaction in interface javax.persistence.EntityManager

getDelegate

public Object getDelegate()
returns the underlying session

Specified by:
getDelegate in interface javax.persistence.EntityManager

throwPersistenceException

public void throwPersistenceException(javax.persistence.PersistenceException e)
Specified by:
throwPersistenceException in interface HibernateEntityManagerImplementor

throwPersistenceException

public void throwPersistenceException(org.hibernate.HibernateException e)
Specified by:
throwPersistenceException in interface HibernateEntityManagerImplementor

wrapStaleStateException

public javax.persistence.PersistenceException wrapStaleStateException(org.hibernate.StaleStateException e)
Specified by:
wrapStaleStateException in interface HibernateEntityManagerImplementor