锘??xml version="1.0" encoding="utf-8" standalone="yes"?>av一本在线,久久久国际精品,欧美极品aⅴ影院http://www.aygfsteel.com/keer2345/category/35775.htmlJavazh-cnThu, 06 Nov 2008 01:14:20 GMTThu, 06 Nov 2008 01:14:20 GMT60HibernateUtil.javahttp://www.aygfsteel.com/keer2345/articles/238941.htmlkeerkeerThu, 06 Nov 2008 00:07:00 GMThttp://www.aygfsteel.com/keer2345/articles/238941.htmlhttp://www.aygfsteel.com/keer2345/comments/238941.htmlhttp://www.aygfsteel.com/keer2345/articles/238941.html#Feedback0http://www.aygfsteel.com/keer2345/comments/commentRss/238941.htmlhttp://www.aygfsteel.com/keer2345/services/trackbacks/238941.html
package com.keer.hibernate;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
    
    
private static final SessionFactory sessionFactory;
    
    
static {
        
try {
            Configuration cfg 
= new Configuration().configure();
            sessionFactory 
= cfg.buildSessionFactory();
        } 
catch(Throwable e) {
            System.err.println(
"Initial SessionFactory creation failed" + e );
            
throw new ExceptionInInitializerError(e);
        }
    }
    
    
public static SessionFactory getSessionFactory() {
        
return sessionFactory;
    }
    
    
public static Session getSession() {
        
return sessionFactory.openSession();
    }
    
    
public static void closeSession(Session session) throws HibernateException {
        
if(session != null) {
            
if(session.isOpen()) {
                session.close();
            }
        }
    }
    
    
public static void rollback( Transaction tran ) {
        
try {
            
if(tran != null) {
                tran.rollback();
            } 
        } 
catch (HibernateException he) {
            System.out.println(
"Rollback faild." + he);
        }
    }   
}






keer 2008-11-06 08:07 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 莲花县| 固安县| 英山县| 万山特区| 噶尔县| 进贤县| 鄂州市| 平昌县| 万荣县| 渭南市| 奉新县| 青冈县| 江永县| 平舆县| 新龙县| 繁峙县| 调兵山市| 五华县| 雅安市| 高雄市| 建宁县| 琼结县| 额尔古纳市| 吉林市| 中宁县| 朔州市| 乌苏市| 华宁县| 苍梧县| 宜君县| 县级市| 宁远县| 彩票| 台北县| 寿宁县| 方正县| 黔西县| 漠河县| 郴州市| 沂水县| 乃东县|