01: package org.hibernate.context;
02:
03: import org.hibernate.HibernateException;
04:
05: import java.io.Serializable;
06:
07: /**
08: * Defines the contract for implementations which know how to
09: * scope the notion of a {@link org.hibernate.SessionFactory#getCurrentSession() current session}.
10: * <p/>
11: * Implementations should adhere to the following:
12: * <ul>
13: * <li>contain a constructor accepting a single argument of type
14: * {@link org.hibernate.engine.SessionFactoryImplementor}
15: * <li>should be thread safe
16: * <li>should be fully serializable
17: * </ul>
18: * <p/>
19: * Implementors should be aware that they are also fully responsible for
20: * cleanup of any generated current-sessions.
21: * <p/>
22: * Note that there will be exactly one instance of the configured
23: * CurrentSessionContext implementation per {@link org.hibernate.SessionFactory}.
24: *
25: * @author <a href="mailto:steve@hibernate.org">Steve Ebersole </a>
26: */
27: public interface CurrentSessionContext extends Serializable {
28: /**
29: * Retrieve the current session according to the scoping defined
30: * by this implementation.
31: *
32: * @return The current session.
33: * @throws org.hibernate.HibernateException Typically indicates an issue
34: * locating or creating the current session.
35: */
36: public org.hibernate.classic.Session currentSession()
37: throws HibernateException;
38: }
|