surveychildcountdaoimpl.java

来自「简单的网上调查系统。采用Spring+Hibernate方式设计架构。」· Java 代码 · 共 36 行

JAVA
36
字号
package com.mySurvey.dao.impl;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.mySurvey.bean.SurveyChildCount;
import com.mySurvey.bean.SurveyOption;
import com.mySurvey.dao.SurveyChildCountDAO;

public class SurveyChildCountDAOImpl extends HibernateDaoSupport implements SurveyChildCountDAO {
	private SessionFactory sessionFactory;
	private String hql = "from SurveyChildCount u where u.surveyChildId = ?";
    public SurveyChildCount query(SurveyChildCount surveyChildCount) {
    	SurveyChildCount surveyChildCount1 = null;
    	//如果查询结果为空
		if (this.getHibernateTemplate().find(hql, surveyChildCount.getSurveyChildId()) == null || this.getHibernateTemplate().find(hql, surveyChildCount.getSurveyChildId()).size() == 0) {
			surveyChildCount1 = null;
		} else {
			//不为空时,取第一笔
			surveyChildCount1 = (SurveyChildCount)(this.getHibernateTemplate().find(hql, surveyChildCount.getSurveyChildId()).get(0));
		}
		return surveyChildCount1;
    }
    //新增调查结果
	public void insert(SurveyChildCount surveyChildCount) {
		this.getHibernateTemplate().save(surveyChildCount);
	}
	//修改调查结果
	public void update(SurveyChildCount surveyChildCount) {
		this.getHibernateTemplate().update(surveyChildCount);
	}
	//删除调查结果
	public void delete(SurveyChildCount surveyChildCount) {
		this.getHibernateTemplate().delete(surveyChildCount);
	}
}

⌨️ 快捷键说明

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