HibernateBaseDAO.java
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
}