org.perfectjpattern.jee.integration.dao
Class HibernateSessionAdapter
java.lang.Object
org.perfectjpattern.core.structural.AbstractSurrogate<T,A>
org.perfectjpattern.core.structural.adapter.Adapter<ISession,org.hibernate.Session>
org.perfectjpattern.jee.integration.dao.HibernateSessionAdapter
- All Implemented Interfaces:
- InvocationHandler, IAdapter<ISession,org.hibernate.Session>, ISurrogate<ISession>
public final class HibernateSessionAdapter
- extends Adapter<ISession,org.hibernate.Session>
Adapts Hibernate's Session
to the JPA implementation-free
PerfectJPattern's ISession
definition
- Version:
- $Revision: 1.0 $Date: Feb 10, 2009 8:26:06 PM $
- Author:
- Giovanni Azua
-
-
HibernateSessionAdapter
public HibernateSessionAdapter(org.hibernate.Session anAdaptee)
throws IllegalArgumentException
- Constructs a
HibernateSessionAdapter
from the Adaptee
Session
instance
- Parameters:
anAdaptee
- Adaptee Hibernate Transaction
- Throws:
IllegalArgumentException
invokeUnderlying
protected Object invokeUnderlying(Method aMethod,
Object[] anArguments)
throws Throwable
- Returns the result of the Method invocation. This method has two
main purposes:
- Provides facility to invoke a method on the actual Underlying
- Concrete surrogate implementations that override this method have
a single point to control access to the actual Underlying method
invokation.
- Overrides:
invokeUnderlying
in class Adapter<ISession,org.hibernate.Session>
- Parameters:
aMethod
- Method to invokeanArguments
- Array of input arguments for the Method to invoke
- Returns:
- result of the Method invocation
- Throws:
Throwable
getTransaction
public ITransaction getTransaction()
find
public <E> E find(Class<E> aPersistentClass,
Object anId)
getDelegate
public org.hibernate.Session getDelegate()
createQuery
public IQuery createQuery(String aSqlString)
createNativeQuery
public IQuery createNativeQuery(String aSqlString,
Class<?> aPersistentClass)
remove
public void remove(Object anObject)
update
public void update(Object anObject)
persist
public <Id> Id persist(Object anObject)
Copyright © 2007-2009. All Rights Reserved.