org.perfectjpattern.jee.integration.dao
Class EntityManagerAdapter

java.lang.Object
  extended by org.perfectjpattern.core.structural.AbstractSurrogate<T,A>
      extended by org.perfectjpattern.core.structural.adapter.Adapter<ISession,javax.persistence.EntityManager>
          extended by org.perfectjpattern.jee.integration.dao.EntityManagerAdapter
All Implemented Interfaces:
InvocationHandler, IAdapter<ISession,javax.persistence.EntityManager>, ISurrogate<ISession>

public final class EntityManagerAdapter
extends Adapter<ISession,javax.persistence.EntityManager>

Adapts JPA's EntityManager to the JPA implementation-free PerfectJPattern's ISession definition

Version:
$Revision: 1.0 $Date: Feb 10, 2009 8:26:06 PM $
Author:
Giovanni Azua
 

Constructor Summary
EntityManagerAdapter(javax.persistence.EntityManager anAdaptee)
          Constructs a EntityManagerAdapter from the Adaptee EntityManager instance
 
Method Summary
 IQuery createNativeQuery(String aSqlString, Class<?> aPersistentClass)
           
 IQuery createQuery(String aSqlString)
           
 ITransaction getTransaction()
           
protected  Object invokeUnderlying(Method aMethod, Object[] anArguments)
          Returns the result of the Method invocation.
 void update(Object anObject)
           
 
Methods inherited from class org.perfectjpattern.core.structural.adapter.Adapter
getAdaptee, getTarget, setAdaptingStrategy
 
Methods inherited from class org.perfectjpattern.core.structural.AbstractSurrogate
equals, getComponent, getComponentClass, getUnderlying, hashCode, invoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.perfectjpattern.core.api.structural.ISurrogate
getComponent
 
Methods inherited from interface java.lang.reflect.InvocationHandler
invoke
 

Constructor Detail

EntityManagerAdapter

public EntityManagerAdapter(javax.persistence.EntityManager anAdaptee)
                     throws IllegalArgumentException
Constructs a EntityManagerAdapter from the Adaptee EntityManager instance

Parameters:
anAdaptee - The Adaptee EntityManager
Throws:
IllegalArgumentException - 'anAdaptee' must not be null
Method Detail

invokeUnderlying

protected Object invokeUnderlying(Method aMethod,
                                  Object[] anArguments)
                           throws Throwable
Returns the result of the Method invocation. This method has two main purposes:

Overrides:
invokeUnderlying in class Adapter<ISession,javax.persistence.EntityManager>
Parameters:
aMethod - Method to invoke
anArguments - Array of input arguments for the Method to invoke
Returns:
result of the Method invocation
Throws:
Throwable

update

public void update(Object anObject)

createQuery

public IQuery createQuery(String aSqlString)

createNativeQuery

public IQuery createNativeQuery(String aSqlString,
                                Class<?> aPersistentClass)

getTransaction

public ITransaction getTransaction()


Copyright © 2007-2009. All Rights Reserved.