|
/*
|
|
* Genererated via NetBeans Hibernate plugin
|
|
*/
|
|
package fr.unicaen.iota.epcilon.util;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.hibernate.SessionFactory;
|
|
import org.hibernate.cfg.Configuration;
|
|
|
|
public final class HibernateUtil {
|
|
|
|
private HibernateUtil() {
|
|
}
|
|
private static final SessionFactory sessionFactory;
|
|
|
|
static {
|
|
try {
|
|
// Create the SessionFactory from hibernate.cfg.xml
|
|
Configuration conf = new Configuration();
|
|
conf.configure();
|
|
sessionFactory = conf.buildSessionFactory();
|
|
} catch (Throwable ex) {
|
|
// Make sure you log the exception, as it might be swallowed
|
|
LogFactory.getLog(HibernateUtil.class).error("Initial SessionFactory creation failed.", ex);
|
|
throw new ExceptionInInitializerError(ex);
|
|
}
|
|
}
|
|
|
|
public static SessionFactory getSessionFactory() {
|
|
return sessionFactory;
|
|
}
|
|
}
|