package org.seasar.hibernate.dao.impl;

import java.lang.reflect.Method;
import java.util.List;

import net.sf.hibernate.Query;

import org.seasar.hibernate.S2SessionFactory;

/**
 * @author kenichi_okazaki
 *
 */
public class HqlQueryCommand extends AbstractQueryHibernateCommand  {

	private String hqlQuery_;
	
	public HqlQueryCommand(S2SessionFactory s2sessionFactory,Class beanClass,Method method) {
		super(s2sessionFactory,beanClass,method);		
	}

	/* (non-Javadoc)
	 * @see org.seasar.hibernate.dao.HibernateCommand#execute(org.seasar.hibernate.S2Session, java.lang.Object[])
	 */
	public Object execute( Object[] args) {
		Query query = getS2Session().createQuery(hqlQuery_);
		
		List ret = QueryExecute( query, args );
		return getReturnObject(getMethod(),ret );
	}

	public String getHqlQuery() {
		return hqlQuery_;
	}

	public void setHqlQuery(String hqlQuery) {
		hqlQuery_ = hqlQuery;
	}
}
