📄 informationdaohibernate.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -