[Trovacap-java-loginfo] jTrovaCap/java/uk/co/marcoratto/util HibernateUtil.java, NONE, 1.1
Brought to you by:
marcoratto
|
From: Marco R. <mar...@us...> - 2008-07-02 14:13:04
|
Update of /cvsroot/trovacap-java/jTrovaCap/java/uk/co/marcoratto/util In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv26823/java/uk/co/marcoratto/util Added Files: HibernateUtil.java Log Message: Update to release 1.2 --- NEW FILE: HibernateUtil.java --- /* * Copyright (C) 2007 Marco Ratto * * This file is part of the project trovacap-java. * * trovacap-java is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * trovacap-java is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with trovacap-java; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package uk.co.marcoratto.util; import org.apache.log4j.Logger; import org.hibernate.*; import org.hibernate.cfg.*; public class HibernateUtil { private static final SessionFactory sessionFactory; private static Logger logger = Logger.getLogger("uk.co.marcoratto.jtrovacap"); static { try { // Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable t) { logger.error(t); throw new ExceptionInInitializerError(t); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } |