package persistence;
import org.hibernate.*;
import org.hibernate.cfg.*;
/**
* Startup Hibernate and provide access to the singleton SessionFactory
*/
public class HibernateUtil {
// private static SessionFactory sessionFactory;
//
// static {
// try {
// sessionFactory = new Configuration().configure().buildSessionFactory();
// } catch (Throwable ex) {
// throw new ExceptionInInitializerError(ex);
// }
// }
//
//
// public static SessionFactory getSessionFactory() {
// // Alternatively, we could look up in JNDI here
// return sessionFactory;
// }
private static SessionFactory sessionFactory = new Configuration()
.configure().buildSessionFactory();
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void shutdown() {
// Close caches and connection pools
getSessionFactory().close();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
hibernateTest20081229.rar (34个子文件)
hibernateTest
log
Snapshot.1 237B
Version_Number 4B
Logfile.1 8B
.myhibernatedata 435B
sql.sql 562B
src
persistence
HibernateUtil.java 875B
anyso
domain
Message.java 647B
Message.hbm.xml 699B
Test.java 481B
hibernate.cfg.xml 878B
.project 1KB
WebRoot
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 284B
classes
persistence
HibernateUtil.class 813B
log4j.properties 355B
anyso
domain
Test.class 1KB
Message.hbm.xml 699B
Message.class 844B
hibernate.cfg.xml 878B
lib
sqljdbc.jar 227KB
commons-logging-1.0.4.jar 37KB
dom4j-1.6.1.jar 307KB
commons-beanutils-1.7.0.jar 184KB
mssqlserver.jar 66KB
commons-lang-2.1.jar 203KB
msbase.jar 280KB
msutil.jar 58KB
commons-collections-2.1.1.jar 171KB
commons-dbcp-1.2.1.jar 105KB
cglib-nodep-2.1_3.jar 317KB
hibernate3.jar 2.08MB
index.html 381B
.mymetadata 312B
.classpath 660B
.myeclipse
共 34 条
- 1
资源评论
vaily_162218
- 粉丝: 2
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功