Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class HibernateUtil {
  2.  
  3.     private static SessionFactory factory;
  4.    
  5.     static {
  6.         Configuration configuration = new AnnotationConfiguration();
  7.         configuration.configure();
  8.         factory = configuration.buildSessionFactory();
  9.     }
  10.    
  11.     public static Session getSession(){
  12.         return factory.openSession();
  13.     }
  14.    
  15. }