electiveinfodaohibernate.java
来自「Spring+hibernate学生在线选课系统」· Java 代码 · 共 57 行
JAVA
57 行
/*
* Created on 2006-1-22
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.mmxbb.schoolelective.dao.hibernate;
import java.util.Date;
import java.util.List;
import org.mmxbb.schoolelective.dao.ElectiveinfoDao;
import org.mmxbb.schoolelective.model.Electiveinfo;
import org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;
/**
* @author mmx
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ElectiveinfoDaoHibernate extends HibernateDaoSupport implements ElectiveinfoDao {
public Electiveinfo load(String id){
Electiveinfo electiveinfo;
try{
electiveinfo = (Electiveinfo)getHibernateTemplate().load(Electiveinfo.class,id);
}catch(HibernateObjectRetrievalFailureException e){
electiveinfo = null;
}
return electiveinfo;
}
public void save(Electiveinfo electiveinfo){
electiveinfo.setSubmittime(new Date());
getHibernateTemplate().save(electiveinfo);
}
public void update(Electiveinfo electiveinfo){
getHibernateTemplate().update(electiveinfo);
}
public void delete(String id){
getHibernateTemplate().delete(load(id));
}
public List find(String query){
return getHibernateTemplate().find(query);
}
public List findAll(){
return getHibernateTemplate().find("from Electiveinfo o");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?