KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > persist > db > DatabaseTransactionFactory


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: DatabaseTransactionFactory.java,v 1.3 2007/01/07 06:14:18 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.persist.db;
23
24 import java.sql.Connection JavaDoc;
25 import java.sql.SQLException JavaDoc;
26
27 import org.opensubsystems.core.util.TransactionFactory;
28
29 /**
30  * Interface to extending the standard transaction factory with database related
31  * transaction activities.
32  *
33  * @version $Id: DatabaseTransactionFactory.java,v 1.3 2007/01/07 06:14:18 bastafidli Exp $
34  * @author Miro Halas
35  * @code.reviewer Miro Halas
36  * @code.reviewed Initial revision
37  */

38 public interface DatabaseTransactionFactory extends TransactionFactory
39 {
40    /**
41     * Commit implicit transaction for given connection. This operation succeed
42     * only if explicit UserTransaction is not in progress. Otherwise it has no
43     * effect. The purpose is that a given component doesn't know if a larger
44     * transaction is in progress or not. Therefore it asks the database
45     * transaction factory to commit the transaction based on connection and
46     * the transaction factory since it is aware of the larger transaction may
47     * decide to commit the transaction based on connection if no larger
48     * transaction is in progress or commit it.
49     *
50     * @param cntConnection - the connection to commit transaction for.
51     * @throws SQLException - problem commiting transaction
52     */

53    void commitTransaction(
54       Connection JavaDoc cntConnection
55    ) throws SQLException JavaDoc;
56
57    /**
58     * Rollback implicit transaction for given connection. This operation succeed
59     * only if explicit UserTransaction is not in progress. Otherwise it has no
60     * effect. The purpose is that a given component doesn't know if a larger
61     * transaction is in progress or not. Therefore it asks the database
62     * transaction factory to rollback the transaction based on connection and
63     * the transaction factory since it is aware of the larger transaction may
64     * decide to rollback the transaction based on connection if no larger
65     * transaction is in progress or rollback it.
66     *
67     * @param cntConnection - the connection to rollback transaction for.
68     * @throws SQLException - problem rolling back transaction
69     */

70    void rollbackTransaction(
71       Connection JavaDoc cntConnection
72    ) throws SQLException JavaDoc;
73 }
74
Popular Tags