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

📄 studentanswertabledao.java

📁 在线考试系统
💻 JAVA
字号:
package exam.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

/**
 * A data access object (DAO) providing persistence and search support for
 * StudentAnswerTable entities. Transaction control of the save(), update() and
 * delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see exam.dao.StudentAnswerTable
 * @author MyEclipse Persistence Tools
 */

public class StudentAnswerTableDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory
			.getLog(StudentAnswerTableDAO.class);
	// property constants
	public static final String SELECTONEANSWER = "selectoneanswer";
	public static final String SELECTMANYANSWER = "selectmanyanswer";
	public static final String BLANKANSWER = "blankanswer";
	public static final String ONEASKANSWER = "oneaskanswer";
	public static final String MANYASKANSWER = "manyaskanswer";
	public static final String COMBINATIONANSWER = "combinationanswer";
	public static final String TESTPAPERID = "testpaperid";

	public void save(StudentAnswerTable transientInstance) {
		log.debug("saving StudentAnswerTable instance");
		try {
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(StudentAnswerTable persistentInstance) {
		log.debug("deleting StudentAnswerTable instance");
		try {
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public StudentAnswerTable findById(exam.dao.StudentAnswerTableId id) {
		log.debug("getting StudentAnswerTable instance with id: " + id);
		try {
			StudentAnswerTable instance = (StudentAnswerTable) getSession()
					.get("exam.dao.StudentAnswerTable", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(StudentAnswerTable instance) {
		log.debug("finding StudentAnswerTable instance by example");
		try {
			List results = getSession().createCriteria(
					"exam.dao.StudentAnswerTable")
					.add(Example.create(instance)).list();
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding StudentAnswerTable instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from StudentAnswerTable as model where model."
					+ propertyName + "= ?";
			Query queryObject = getSession().createQuery(queryString);
			queryObject.setParameter(0, value);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findBySelectoneanswer(Object selectoneanswer) {
		return findByProperty(SELECTONEANSWER, selectoneanswer);
	}

	public List findBySelectmanyanswer(Object selectmanyanswer) {
		return findByProperty(SELECTMANYANSWER, selectmanyanswer);
	}

	public List findByBlankanswer(Object blankanswer) {
		return findByProperty(BLANKANSWER, blankanswer);
	}

	public List findByOneaskanswer(Object oneaskanswer) {
		return findByProperty(ONEASKANSWER, oneaskanswer);
	}

	public List findByManyaskanswer(Object manyaskanswer) {
		return findByProperty(MANYASKANSWER, manyaskanswer);
	}

	public List findByCombinationanswer(Object combinationanswer) {
		return findByProperty(COMBINATIONANSWER, combinationanswer);
	}

	public List findByTestpaperid(Object testpaperid) {
		return findByProperty(TESTPAPERID, testpaperid);
	}

	public List findAll() {
		log.debug("finding all StudentAnswerTable instances");
		try {
			String queryString = "from StudentAnswerTable";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public StudentAnswerTable merge(StudentAnswerTable detachedInstance) {
		log.debug("merging StudentAnswerTable instance");
		try {
			StudentAnswerTable result = (StudentAnswerTable) getSession()
					.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(StudentAnswerTable instance) {
		log.debug("attaching dirty StudentAnswerTable instance");
		try {
			getSession().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(StudentAnswerTable instance) {
		log.debug("attaching clean StudentAnswerTable instance");
		try {
			getSession().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}
}

⌨️ 快捷键说明

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