informationdaohibernate.java
来自「这个是完整的wap项目的源码 开发语言 Java 系统架构 Struts +」· Java 代码 · 共 58 行
JAVA
58 行
package com.longtime.wap.frame.dao.hibernate;
import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import com.longtime.wap.common.BaseDao;
import com.longtime.wap.frame.dao.InformationDao;
/**
* 定义对information的持久化类进行操作的接口
*
* @author bulc
* @date 2007-11-3
*/
public class InformationDaoHibernate extends BaseDao implements InformationDao {
/**
* 统计信息总数
*
* @return 信息总数
*/
public int retireveInformationCount() {
return (Integer) this.getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session
.createQuery("select count(*) from Information");
return query.uniqueResult();
}
});
}
/**
* 统计发布的信息总数
*
* @return 已发布的信息总数
*/
public int retrieveInformationPubCount() {
return (Integer) this.getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Query query = session
.createQuery("select count(*) "
+ "from Information where isPub=1");
return query.uniqueResult();
}
});
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?