01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package org.terracotta.modules.hibernate_3_1_2.util;
06:
07: import org.hibernate.SessionFactory;
08: import org.hibernate.cfg.Configuration;
09:
10: public class HibernateUtil {
11:
12: private static final SessionFactory sessionFactory;
13:
14: static {
15: try {
16: // Create the SessionFactory from hibernate.cfg.xml
17: sessionFactory = new Configuration().configure()
18: .buildSessionFactory();
19: } catch (Throwable ex) {
20: ex.printStackTrace(System.err);
21: throw new ExceptionInInitializerError(ex);
22: }
23: }
24:
25: public static SessionFactory getSessionFactory() {
26: return sessionFactory;
27: }
28:
29: }
|