001 /*******************************************************************************
002 * Copyright (c) PicoContainer Organization. All rights reserved.
003 * ---------------------------------------------------------------------------
004 * The software in this package is published under the terms of the BSD style
005 * license a copy of which has been included with this distribution in the
006 * license.html file.
007 ******************************************************************************/
008
009 package org.picocontainer.persistence.hibernate;
010
011 import org.hibernate.SessionFactory;
012 import org.picocontainer.Startable;
013
014 /**
015 * Add lifecycle methods to the delegate factory
016 *
017 * @author Jose Peleteiro
018 * @author Mauro Talevi
019 */
020 public final class SessionFactoryLifecycle implements Startable {
021
022 private final SessionFactory sessionFactory;
023
024 public SessionFactoryLifecycle(SessionFactory sessionFactory) {
025 this.sessionFactory = sessionFactory;
026 }
027
028 public void start() {
029 }
030
031 public void stop() {
032 if (sessionFactory != null) {
033 sessionFactory.close();
034 }
035 }
036 }