Hibernate4.3.9获取SessionFactory的方法
来源:互联网 发布:linux apt get 安装 编辑:程序博客网 时间:2024/06/10 23:48
ServiceRegistryBuilder类已经过期。废话不多说,直接上代码:
import org.hibernate.SessionFactory;import org.hibernate.boot.registry.StandardServiceRegistryBuilder;import org.hibernate.cfg.Configuration;import org.hibernate.service.ServiceRegistry;public class HibernateUtil {private static final SessionFactory sessionFactory = buildSessionFactory();private static SessionFactory buildSessionFactory() {try {// Create the SessionFactory from hibernate.cfg.xmlConfiguration conf = new Configuration().configure();ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();return conf.buildSessionFactory(serviceRegistry);}catch (Throwable ex) {// Make sure you log the exception, as it might be swallowedSystem.err.println("Initial SessionFactory creation failed." + ex);throw new ExceptionInInitializerError(ex);}}public static SessionFactory getSessionFactory() {return sessionFactory;}}
0 0
- Hibernate4.3.9获取SessionFactory的方法
- Hibernate4中获取SessionFactory的方法
- Hibernate4 获取SessionFactory 的方式
- Hibernate4 获取SessionFactory 的方式
- Hibernate、Hibernate4获取SessionFactory对象方法的变化
- Hibernate、Hibernate4获取SessionFactory对象方法的变化
- Hibernate4 获取SessionFactory 的2种方式
- Hibernate4中获取SessionFactory
- hibernate4 获取sessionFactory
- hibernate4获取SessionFactory
- hibernate4.3创建SessionFactory的方法
- Hibernate4的SessionFactory
- Hibernate4.3.1创建SessionFactory方法
- hibernate SessionFactory的获取方法
- hibernate 获取SessionFactory的方法
- hibernate4.2版本sessionFactory方法和旧版本的不同
- Spring4+Hibernate4整合,关于获取SessionFactory
- Spring3与hibernate4整合,sessionFactory.getCurrentSession()方法获取不到Session对象异常解决办法
- C++ map的用法
- bundle install 找不到库文件,用 config 参数指定本地类库
- 使用密码登陆OpenStack云主机
- swift中使用CoreData实现增删查改
- 误删资料恢复
- Hibernate4.3.9获取SessionFactory的方法
- DISCUZ浅析之COOKIE篇
- almostSorted
- 浅谈STL中的find及其扩展函数
- 【转载】char*,const char*和string 三者转换
- Linux系统编程——系统调用之 I/O 操作(文件操作)
- 使用FD_CLOEXEC实现close-on-exec,关闭子进程无用文件描述符
- android应用之——为自己的apk签名
- 《Hadoop基础教程》之初识Hadoop