Last change
on this file since 507 was 507, checked in by George Lilly, 15 years ago |
NHIN gateway and adaptor for use on linux with VistA EHR and RPMS
|
File size:
1.1 KB
|
Rev | Line | |
---|
[507] | 1 | /*
|
---|
| 2 | * To change this template, choose Tools | Templates
|
---|
| 3 | * and open the template in the editor.
|
---|
| 4 | */
|
---|
| 5 | package gov.hhs.fha.nhinc.patientcorrelation.persistence;
|
---|
| 6 |
|
---|
| 7 | import org.hibernate.SessionFactory;
|
---|
| 8 | import org.hibernate.cfg.Configuration;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * This class will be used as a Utility Class to access the Data Object using Hibernate SessionFactory
|
---|
| 12 | * @author svalluripalli
|
---|
| 13 | */
|
---|
| 14 | public class HibernateUtil {
|
---|
| 15 | private static final SessionFactory sessionFactory;
|
---|
| 16 | static {
|
---|
| 17 | try {
|
---|
| 18 | // Create the SessionFactory from hibernate.cfg.xml
|
---|
| 19 | sessionFactory = new Configuration().configure().buildSessionFactory();
|
---|
| 20 | } catch (Throwable ex) {
|
---|
| 21 | // Make sure you log the exception, as it might be swallowed
|
---|
| 22 | System.err.println("Initial SessionFactory creation failed." + ex);
|
---|
| 23 | throw new ExceptionInInitializerError(ex);
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * Method returns an instance of Hibernate SessionFactory
|
---|
| 29 | * @return SessionFactory
|
---|
| 30 | */
|
---|
| 31 | public static SessionFactory getSessionFactory() {
|
---|
| 32 | return sessionFactory;
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.