1 /*
2 * Copyright (c) 2003
3 * Information Desire GmbH
4 * All rights reserved.
5 */
6 package com.infodesire.infobit.hibernate;
7
8 import net.sf.hibernate.Session;
9 import net.sf.hibernate.HibernateException;
10 import java.util.Properties;
11 import com.infodesire.infobit.InfobitException;
12
13 /***
14 * implementors shall deliver hibernate session on demand.
15 *
16 * @author konstantin
17 * @created August 6, 2003
18 * @version $Revision: 1.4 $
19 */
20 public interface SessionProvider {
21
22 /***
23 * provide hibernate session out of factory
24 *
25 * @return The Session value
26 * @exception HibernateException Description of Exception
27 */
28 Session getSession() throws HibernateException;
29
30
31 /***
32 * rollback active transaction if any. shall be called in case whe something
33 * went wrong before closing and returning session.
34 *
35 * @exception HibernateException Description of Exception
36 */
37 void rollback() throws HibernateException;
38
39
40 /***
41 * put session back. session may be flushed on behalf of implementing class
42 *
43 * @param sess Description of Parameter
44 * @exception HibernateException Description of Exception
45 */
46 public void returnSession(Session sess) throws HibernateException;
47
48
49 /***
50 * return session back and close it. this method shall be called in case of
51 * errors to kill tainted session.
52 *
53 * @param sess Description of Parameter
54 * @exception HibernateException Description of Exception
55 */
56 public void returnCloseSession(Session sess) throws HibernateException;
57
58
59 /***
60 * initialize factory with properties
61 *
62 * @param properties Description of Parameter
63 * @exception InfobitException Description of Exception
64 */
65 public void init(Properties properties) throws InfobitException;
66
67 }
This page was automatically generated by Maven