001 /*****************************************************************************
002 * Copyright (c) PicoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the license.html file. *
007 * *
008 * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant *
009 *****************************************************************************/
010 package org.nanocontainer.persistence.hibernate.classic;
011
012 import net.sf.hibernate.SessionFactory;
013 import net.sf.hibernate.HibernateException;
014
015 import org.picocontainer.Startable;
016
017 /**
018 * component organising lifecycle for session factory
019 * @author Konstanti Pribluda
020 * @version $Revision: 2043 $
021 */
022 public class SessionFactoryLifecycle implements Startable {
023 SessionFactory sessionFactory;
024
025 public SessionFactoryLifecycle(SessionFactory sessionFactory) {
026 this.sessionFactory = sessionFactory;
027 }
028
029 public void start() {
030 }
031
032 public void stop() {
033 try {
034 sessionFactory.close();
035 } catch(HibernateException ex) {
036 //swallow it? not sure what to do with it...
037 }
038 }
039 }
040
041