View Javadoc
1   /******************************************************************************
2    * HibernateUtil.java - Non-object access to the database 
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2014 - Dick Balaska
6    * 
7    */
8   
9   package com.buckosoft.PicMan.db;
10  
11  import org.hibernate.SessionFactory;
12  import org.hibernate.cfg.Configuration;
13  
14  /** Non-object access to the database. <br>
15   * This class is really private to DatabaseImpl.
16   * @author Dick Balaska
17   * @since 2014/06/01
18   * @see <a href="http://cvs.buckosoft.com/Projects/PicMan/PicMan/src/com/buckosoft/PicMan/db/HibernateUtil.java">cvs HibernateUtil.java</a>
19   */
20  final class HibernateUtil {
21  
22      private static final SessionFactory sessionFactory = buildSessionFactory();
23  
24      @SuppressWarnings("deprecation")
25  	private static SessionFactory buildSessionFactory() {
26      	Configuration configuration = new Configuration().configure("PicMan-hibernate.cfg.xml");	//.setProperties(props);
27  		return(configuration.buildSessionFactory());		// XXX deprecated hibernate init
28      }
29  
30      public static SessionFactory getSessionFactory() {
31          return sessionFactory;
32      }
33  
34  }