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 NamedQueryCommand extends AbstractQueryHibernateCommand  {


	private String namedQueryPath_;
	
	public NamedQueryCommand(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().getNamedQuery( namedQueryPath_);
		List ret = QueryExecute( query, args );
		return getReturnObject(getMethod(),ret );
	}


	/**
	 * @return Returns the namedQueryPath_.
	 */
	public String getNamedQueryPath_() {
		return namedQueryPath_;
	}
	/**
	 * @param namedQueryPath_ The namedQueryPath_ to set.
	 */
	public void setNamedQueryPath_(String namedQueryPath_) {
		this.namedQueryPath_ = namedQueryPath_;
	}
}
