SessionFactoryUtil

package com.huaweisymantec.rmc.core.utils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class SessionFactoryUtil {

private static SessionFactory sf;
private SessionFactoryUtil(){

}
static{
   sf= new AnnotationConfiguration().configure().buildSessionFactory();
}
public static SessionFactory getSessionFactory(){
return  sf;
}
}

你可能感兴趣的:(Hibernate)