425bc7c81b04ed4c00ed0219a4608428c4da4d4d.svn-base 1.2 KB
package com.espeed.dao;

import java.io.Serializable;
import java.util.List;

import com.espeed.vo.PageBean;


/**
 * hibernate公共操作接口
 */
public interface HibernateBaseDAO<T extends Serializable ,Pk extends Serializable> {
	
	/**增加记录**/
	int  add(T o)throws Exception;
	 /**修改记录*/
	void update(T o)throws Exception;
	 /**删除记录*/
	void del(T o)throws Exception;
	/**添加或更新*/
	void saveOrUpdate(T o)throws Exception;
	/**根据ID获取一条数据*/
	T get(Class<T> t,Pk pk)throws Exception;
	/**根据ID获取一条数据*/
	T load(Class<T> t,Pk pk)throws Exception;  
	/**根据hql进行条件查询*/
	List<T> getAll(String hql)throws Exception;
	 /**条件查询*/
    List<T> getAll(String whereHql,Object...params)throws Exception;  
	

    /** 根据指定的HQL(多条件)进行查询*/
    public List<T> findByPage(String hql,String hqlCount, PageBean pb) throws Exception;
	/** 根据指定的HQL(多条件)进行查询*/
	public List<T> findByPage(String hql,String hqlCount,PageBean pb,Object...values) throws Exception;
	

	/**根据条件查询总记录*/
	public int count(String hql) throws Exception;
	/**根据条件和参数查询总记录*/
	public int count(String hql, Object... params) throws Exception;

}