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:
849 bytes
|
Rev | Line | |
---|
[507] | 1 | package gov.hhs.fha.nhinc.repository.persistence;
|
---|
| 2 |
|
---|
| 3 | import org.hibernate.SessionFactory;
|
---|
| 4 | import org.hibernate.cfg.Configuration;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Utility to obtain hibernate connections.
|
---|
| 8 | *
|
---|
| 9 | * @author Neil Webb
|
---|
| 10 | */
|
---|
| 11 | public class HibernateUtil
|
---|
| 12 | {
|
---|
| 13 |
|
---|
| 14 | private static final SessionFactory sessionFactory;
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | static
|
---|
| 18 | {
|
---|
| 19 | try
|
---|
| 20 | {
|
---|
| 21 | // Create the SessionFactory from hibernate.cfg.xml
|
---|
| 22 | sessionFactory = new Configuration().configure().buildSessionFactory();
|
---|
| 23 | } catch (Throwable ex)
|
---|
| 24 | {
|
---|
| 25 | // Make sure you log the exception, as it might be swallowed
|
---|
| 26 | System.err.println("Initial SessionFactory creation failed." + ex);
|
---|
| 27 | throw new ExceptionInInitializerError(ex);
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public static SessionFactory getSessionFactory()
|
---|
| 32 | {
|
---|
| 33 | return sessionFactory;
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.