Welcome 微信登录

首页 / 数据库 / MySQL / Hibernate辅助类(官方推荐)

Hibernate辅助类(官方推荐)
  1. public class HibernateUtil {   
  2.     private static final SessionFactory sessionFactory = buildSessionFactory();   
  3.     private static SessionFactory buildSessionFactory() {   
  4.         try {   
  5.             // Create the SessionFactory from hibernate.cfg.xml   
  6.             return new Configuration().configure().buildSessionFactory();   
  7.         } catch (Throwable ex) {  
  8.             // Make sure you log the exception, as it might be swallowed   
  9.             System.err.println("Initial SessionFactory creation failed." + ex);   
  10.             throw new ExceptionInInitializerError(ex);  
  11.         }   
  12.     }   
  13.     public static SessionFactory getSessionFactory() {   
  14.         return sessionFactory;   
  15.     }  
  16. }  
Hibernate(Jar包详解)Hibernate优缺点相关资讯      hibernate 
  • Hibernate利用@DynamicInsert和@  (今 07:09)
  • Hibernate某些版本(4.3)下报错   (04月20日)
  • Hibernate 5.1.0 正式版发布下载  (02月12日)
  • Hibernate的get和load的区别  (08月07日)
  • Hibernate3.1.2_中文文档PDF  (02月17日)
  • Hibernate ORM 5.0.6 发布下载  (12/17/2015 17:12:55)
本文评论 查看全部评论 (0)
表情: 姓名: 字数