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

📄 activedao.java

📁 一个oa系统
💻 JAVA
字号:
package com.oa.db;

import java.util.List;

import org.hibernate.HibernateException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class ActiveDAO  extends HibernateDaoSupport{
	public void save(Active vo){
		try {
			this.getHibernateTemplate().save(vo);
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	    
	}
	
	public List Query(){
		List list = null;
		try {
	       list = this.getHibernateTemplate().find("from Active");
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
    }
	
	public List QuerybyKeyword(String keyword){
		List list = null;
		try {
	       list = this.getHibernateTemplate().find("from Active where topic like ?  or realpicture like ? or realname like ?",new Object[]{"%"+keyword+"%","%"+keyword+"%","%"+keyword+"%"});;
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
    }
	
	public List QuerybyId(int id){
		List list = null;
		try {
	       list = this.getHibernateTemplate().find("from Active where id=?", id);
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
    }
}

⌨️ 快捷键说明

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