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

📄 shitioptiondaoimpl.java

📁 网上调查系统主要有管理员指定调查
💻 JAVA
字号:
package com.myExam.dao.impl;
import java.util.ArrayList;
import java.util.List;

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

import com.myExam.bean.ShitiOption;
import com.myExam.dao.ShitiOptionDAO;
public class ShitiOptionDAOImpl extends HibernateDaoSupport implements ShitiOptionDAO{
	private SessionFactory sessionFactory;
	private String hql = "from ShitiOption u where u.id = ?";
	private String hql2 = "from ShitiOption u where u.shitiId = ?";
//	查询多笔试题项目
    public List queryListByShitiId(int typeId) {
		List list = new ArrayList();
		list = this.getHibernateTemplate().find(hql2, typeId);
		return list;
    }
	private String hql1 = "from ShitiOption u ";
//	查询多笔试题项目
    public List queryList() {
		List list = new ArrayList();
		list = this.getHibernateTemplate().find(hql1);
		return list;
    }
	//查询试题项目
    public ShitiOption query(int id) {
    	ShitiOption shitiOption = null;
    	//如果查询结果为空
		if (this.getHibernateTemplate().find(hql, id) == null ) {
			shitiOption = null;
		} else {
			//不为空时,取第一笔
			shitiOption = (ShitiOption)(this.getHibernateTemplate().find(hql, id).get(0));
		}
		return shitiOption;
    }
	//新增试题项目
	public void insert(ShitiOption shitiOption) {
		this.getHibernateTemplate().save(shitiOption);
	}
	//修改试题项目
	public void update(ShitiOption shitiOption) {
		this.getHibernateTemplate().update(shitiOption);
	}
	//删除试题项目
	public void delete(ShitiOption shitiOption) {
		this.getHibernateTemplate().delete(shitiOption);
	}
}

⌨️ 快捷键说明

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