⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basedao.java

📁 SSH的平台搭建
💻 JAVA
字号:
package com.lovo.zengxy.base.dao;

import java.util.List;

import org.hibernate.criterion.Criterion;

import com.lovo.zengxy.util.BaseDAOException;

/**
 * 基类DAO接口
 * @author fw
 *
 */
public interface BaseDAO {
	
	/**
	 * 保存一个对象
	 * @param object
	 */
	public abstract void save(Object object) throws BaseDAOException;
	
	
	/**
	 * 修改一个对象
	 * @param object
	 */
	public abstract void update(Object object) throws BaseDAOException;
	
	
	/**
	 * 按主键删除一个对象
	 * @param id
	 * @param clazz
	 */
	public abstract void delete(long id,Class clazz) throws BaseDAOException;
	
	
	/**
	 * 按主键查找一个对象 load
	 * @param id
	 * @param clazz
	 * @return Object
	 */
	public abstract Object load(long id,Class clazz) throws BaseDAOException;
	
	/**
	 * 按主键查找一个对象 get
	 * @param id
	 * @param clazz
	 * @return
	 * @throws BaseDAOException
	 */
	public abstract Object get(long id,Class clazz) throws BaseDAOException;
	
	
	/**
	 * 获得分页记录
	 * @param firstResult
	 * @param maxResults
	 * @param hql
	 * @param objs
	 * @return List
	 */
	public abstract List cutPage(int firstResult,int maxResults,String hql,Object[] objs) throws BaseDAOException;
	
	
	/**
	 * 查询所有记录
	 * @param clazz
	 * @return List
	 */
	public abstract List findAll(Class clazz) throws BaseDAOException;
	
	
	/**
	 * 条件查询多条记录
	 * @param hql
	 * @param args
	 * @return List
	 */
	public abstract List findByCondition(final String hql,Object[] args) throws BaseDAOException;
	
	
	/**
	 * 条件查询1条记录
	 * @param hql
	 * @param args
	 * @return Object
	 */
	public abstract Object getByCondition(final String hql,Object[] args) throws BaseDAOException;
	
	
	/**
	 * 条件修改
	 * @param hql
	 * @param args
	 */
	public abstract int updateByCondition(final String hql,Object[] args) throws BaseDAOException;
	
	/**
	 * 条件删除
	 * @param hql
	 * @param args
	 */
	public abstract int deleteByCondition(final String hql,Object[] args) throws BaseDAOException;
	
	
	/**
	 * 删除全部
	 * @param clazz
	 * @return int
	 */
	public abstract int deleteAll(final Class clazz) throws BaseDAOException;
	
	/**
	 * 按Criteria条件查询
	 * @param clazz
	 * @param criterion
	 * @return
	 * @throws BaseDAOException
	 */
	public abstract List findByCriteria(Class clazz,Criterion... criterion)throws BaseDAOException;

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -