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

📄 informationdaohibernate.java

📁 这个是完整的wap项目的源码 开发语言 Java 系统架构 Struts + hibernate + spring 数据库 Mysql5.0 应用服务器Tomcat5.0 开发工具 MyEc
💻 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 + -