org.perfectjpattern.jee.integration.dao
Class HibernateQueryAdapter

java.lang.Object
  extended by org.perfectjpattern.core.structural.AbstractSurrogate<T,A>
      extended by org.perfectjpattern.core.structural.adapter.Adapter<IQuery,org.hibernate.Query>
          extended by org.perfectjpattern.jee.integration.dao.HibernateQueryAdapter
All Implemented Interfaces:
InvocationHandler, IAdapter<IQuery,org.hibernate.Query>, ISurrogate<IQuery>

public class HibernateQueryAdapter
extends Adapter<IQuery,org.hibernate.Query>

Adapts Hibernate's Query to the JPA implementation-free PerfectJPattern's IQuery definition

Version:
$Revision: 1.0 $Date: Feb 18, 2009 11:54:49 AM $
Author:
Giovanni Azua
 

Constructor Summary
HibernateQueryAdapter(org.hibernate.Query anAdaptee)
          Constructs a HibernateQueryAdapter from the Adaptee Query instance
 
Method Summary
<E> List<E>
getResultList()
           
 Object getSingleResult()
          Returns the query result as a single result
protected  Object invokeUnderlying(Method aMethod, Object[] anArguments)
          Returns the result of the Method invocation.
 
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

HibernateQueryAdapter

public HibernateQueryAdapter(org.hibernate.Query anAdaptee)
                      throws IllegalArgumentException
Constructs a HibernateQueryAdapter from the Adaptee Query instance

Parameters:
anAdaptee - Adaptee Hibernate Query
Throws:
IllegalArgumentException
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<IQuery,org.hibernate.Query>
Parameters:
aMethod - Method to invoke
anArguments - Array of input arguments for the Method to invoke
Returns:
result of the Method invocation
Throws:
Throwable

getResultList

public <E> List<E> getResultList()

getSingleResult

public Object getSingleResult()
Returns the query result as a single result

Returns:
query result as a single result


Copyright © 2007-2009. All Rights Reserved.