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

📄 chatdao.java

📁 jquery聊天室!!!!!!!!!!!!!!!!!!!!
💻 JAVA
字号:
package db;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Example;



/**
 * A data access object (DAO) providing persistence and search support for Chat
 * entities. Transaction control of the save(), update() and delete() operations
 * can directly support Spring container-managed transactions or they can be
 * augmented to handle user-managed Spring transactions. Each of these methods
 * provides additional information for how to configure it for the desired type
 * of transaction control.
 * 
 * @see db.Chat
 * @author MyEclipse Persistence Tools
 */

public class ChatDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory.getLog(ChatDAO.class);

	public Session getSession() {
		return HibernateSessionFactory.getSession();
	}
	public Transaction getTransaction() {
		return getSession().beginTransaction();
	}
	
	public void save(Chat transientInstance) {
		log.debug("saving Chat instance");
		try {
			getSession().save(transientInstance);
			getTransaction().commit();
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public List findAll() {
		log.debug("finding all Chat instances");
		try {
			String queryString = "from Chat";
			Query queryObject = getSession().createQuery(queryString);
			getSession().clear();
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}
 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -