📄 csubjectdao.java
字号:
package cn.hope.front.pojo.dao;
import java.util.List;
import org.apache.log4j.Logger;
import net.sf.hibernate.HibernateException;
import cn.hope.front.pojo.CSubject;
import cn.hope.front.pojo.base.BaseCSubjectDAO;
public class CSubjectDAO extends BaseCSubjectDAO {
Logger log = Logger.getLogger(CSubjectDAO.class.getName());
/**
* Default constructor. Can be used in place of getInstance()
*/
public CSubjectDAO () {}
/*****************jinxl****************/
public List searchAll() throws HibernateException {
List list = null;
String sqlStr = "select cSubject from CSubject cSubject where cSubject.flag='0' ";
try {
initialize();
list = this.getSession().find(sqlStr);
} catch (HibernateException e) {
log.error(e);
e.printStackTrace();
throw new HibernateException(e);
} finally {
closeCurrentThreadSessions();
}
return list;
}
public CSubject searchByKey(Integer id) throws HibernateException {
CSubject cSubject = null;
String sqlStr = "select cSubject from CSubject cSubject where cSubject.flag='0' and cSubject.SSid='"
+ id + "'";
try {
initialize();
List list = this.getSession().find(sqlStr);
if (list.size() > 0) {
cSubject = (CSubject) list.get(0);
}
} catch (HibernateException e) {
log.error(e);
e.printStackTrace();
throw new HibernateException(e);
} finally {
closeCurrentThreadSessions();
}
return cSubject;
}
/***********************jinxl********************/
private int count = 0;
public int getCount() {
return this.count;
}
public List csubjectAround()throws HibernateException{
String sqlStr = "select cSubject from CSubject cSubject where cSubject.flag='0'";
List list = null;
try {
initialize();
list = this.getSession().find(sqlStr);
}
catch(HibernateException e){
log.error(e);
e.printStackTrace();
throw new HibernateException(e);
}
finally{
closeCurrentThreadSessions();
}
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -