org.clazzes.util.jpa.dao
Class JpaDAOSupport

java.lang.Object
  extended by org.clazzes.util.jpa.dao.JpaDAOSupport
Direct Known Subclasses:
GenericJpaDAO

public class JpaDAOSupport
extends java.lang.Object

A base class for DAO object, which consume an EntityManager opened by an EntityManagerInterceptor.


Constructor Summary
JpaDAOSupport()
           
 
Method Summary
protected  javax.persistence.EntityManager getEntityManager()
           
 java.lang.String getThreadLocalKey()
           
 void setThreadLocalKey(java.lang.String threadLocalKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JpaDAOSupport

public JpaDAOSupport()
Method Detail

getEntityManager

protected javax.persistence.EntityManager getEntityManager()
Returns:
The entity manager previously bound to the current thread using ThreadLocalManager.bindResource(String, Object).
Throws:
org.clazzes.util.aop.DAOException - If no EntityManager has been bound to the current thread.

getThreadLocalKey

public java.lang.String getThreadLocalKey()
Returns:
the threadLocalKey under which the EntityManager has been previously bound to the current thread using ThreadLocalManager.bindResource(String, Object).

setThreadLocalKey

public void setThreadLocalKey(java.lang.String threadLocalKey)
Parameters:
threadLocalKey - the threadLocalKey under which the EntityManager is bound to the current thread using ThreadLocalManager.bindResource(String, Object) to set.


Copyright © 2011. All Rights Reserved.