Advertisement
santiagotapiay

HibernateUtil

May 1st, 2011
2,628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement