KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > server > sql > Transaction


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: Transaction.java,v 1.1 2004/09/03 13:42:37 sinisa Exp $
22  */

23 package com.lutris.appserver.server.sql;
24
25 import java.sql.SQLException JavaDoc;
26
27 /**
28  * Interface that must be implemented by objects accessed by DBTransaction.
29  *
30  * @author Kyle Clark
31  * @version $Revision: 1.1 $
32  * @see DBTransaction
33  */

34 public interface Transaction {
35
36     /**
37      * Method to insert a new object into the database.
38      *
39      * @param conn Database connection.
40      * @exception java.sql.SQLException If a database access error
41      * occurs.
42      */

43     public void executeInsert(DBConnection conn)
44         throws SQLException JavaDoc;
45
46     /**
47      * If this object's <code>executeInsert</code> method was
48      * called then <code>finalizeInsert</code> is called with
49      * the status of the database transaction. This method
50      * allows the data object to perform any post processing
51      * if the transaction succeeded or failed.
52      *
53      * @param success true if the transaction succeeded
54      * and this object was successfully inserted into the database.
55      */

56     public void finalizeInsert(boolean success);
57
58     /**
59      * Method to update contents of object in database.
60      *
61      * @param conn Database connection.
62      * @exception java.sql.SQLException If a database access error
63      * occurs.
64      */

65     public void executeUpdate(DBConnection conn)
66         throws SQLException JavaDoc;
67
68     /**
69      * If this object's <code>executeUpdate</code> method was
70      * called then <code>finalizeUpdate</code> is called with
71      * the status of the database transaction.
72      * For instance the data object may want to
73      * increment its version number once it has successfully
74      * been commited to the database.
75      *
76      * @param success true if the transaction succeeded
77      * and this object was successfully updated in the database.
78      */

79     public void finalizeUpdate(boolean success);
80
81     /**
82      * Method to delete an object from the database.
83      *
84      * @param conn Database connection.
85      * @exception java.sql.SQLException If a database access error
86      * occurs.
87      */

88     public void executeDelete(DBConnection conn)
89         throws SQLException JavaDoc;
90
91     /**
92      * If this object's <code>executeDelete</code> method was
93      * called then <code>finalizeDelete</code> is called with
94      * the status of the database transaction.
95      *
96      * @param success true if the transaction succeeded
97      * and this object was successfully deleted from the
98      * database.
99      */

100     public void finalizeDelete(boolean success);
101 }
102
Popular Tags