Hibernate 4中buildSessionFactory()过时
来源:互联网 发布:java怎么打成jar 编辑:程序博客网 时间:2024/04/30 17:28
import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.cfg.Configuration;import org.hibernate.service.ServiceRegistryBuilder;public class MySessionFactory{ private static Configuration cfg = new Configuration(); private static SessionFactory sf = null; private static ThreadLocal<Session> threadlocal = new ThreadLocal<Session>(); static{ cfg.configure("hibernate.cfg.xml"); ServiceRegistryBuilder srb = new ServiceRegistryBuilder().applySettings(cfg.getProperties()); sf = cfg.buildSessionFactory(srb.buildServiceRegistry()); } public static Session get_current_session() { Session session = (Session) threadlocal.get(); if(session==null || !session.isOpen()) { session = sf.getCurrentSession(); threadlocal.set(session); } return session; } public static void close_session() { Session session = (Session) threadlocal.get(); if(session != null) threadlocal.set(null); }}
0 0
- Hibernate 4中buildSessionFactory()过时
- hibernate 4中buildSessionFactory() 方法过时的替换方法
- hibernate里的buildSessionFactory过时
- [Hibernate]关于Hibernate buildsessionfactory()过时处理
- Hibernate系列之----Hibernate4.1.5 buildSessionFactory过时
- hibernate4.1.4 Final 中 buildSessionFactory() 过时
- Hibernate4的buildSessionFactory过时
- Hibernate4 buildSessionFactory过时解决方案HibernateUtil
- hibernate4.0 buildSessionFactory过时问题
- Hibernate4.3 buildSessionFactory过时解决方案
- Hibernate4.3.8 buildSessionFactory过时解决方案HibernateUtil
- buildSessionFactory 和 ServiceRegistryBuilder in Hibernate 4.3.4 被弃用.
- hibernate4.0 中buildSessionFactory()
- Hibernate4 buildSessionFactory过时解决方案(Annotation也是一样解决)
- Configuration.buildSessionFactory()过时之后,获取SessionFactory的写法
- hibernate 4.x buildSessionFactory 的使用
- Hibernate4中buildSessionFactory方法废弃问题。
- hibernate4.0 中buildSessionFactory()新方式解惑
- linux定时任务 掉mysql 存储过程
- win7 x64 下VC6的调试程序无法退出的问题解决方法
- *.tar.gz文件包安装
- win7下架设IIS其他电脑无法访问的解决办法
- 解决MSSQL 2008不能用IP登录的问题
- Hibernate 4中buildSessionFactory()过时
- [Other] Inno Setup 使用心德-一个完整的项目 包括.NET组建捆绑 去空格等
- 职场人要远离的各种“负能量”
- FileZilla 帐号密码
- 判断数据库表是否存在,删除再创建
- Relevance Ranking: from Web Search to Vertical Search 报告
- IOS面经系列(一)浅析OC之内存管理
- 突破思维的障碍
- memcached启动过程2(改用自己的语言来叙述)