構文
void beginTransaction()
パラメーター
なし。
戻り値
なし。
例外
CwDBConnectionException -- データベース・エラーが発生した場合。
注記
beginTransaction() メソッドは、現行接続における新規の明示的なトランザクションの開始を示します。beginTransaction()、commit()、および rollBack() メソッドはともに、明示的なトランザクションに対するトランザクション境界の管理を提供します。このトランザクションには、SQL 照会 (SQL ステートメント INSERT、DELETE、または UPDATE を含む) と、これらの SQL ステートメントの 1 つを含むストアード・プロシージャーとが含まれます。
明示的なトランザクションを開始する前に、getDBConnection() メソッドを使用して BaseCollaboration クラスから CwDBConnection オブジェクトを作成しておく必要があります。この接続では、明示的なトランザクション・ブラケットを必ず使用してください。
例
次の例では、トランザクションを使用して、CustDBConnPool の中の接続に関連付けられているデータベース表に行を挿入する照会を実行します。
CwDBConnection connection = getDBConnection("CustDBConnPool", false); // Begin a transaction connection.beginTransaction(); // Insert a row connection.executeSQL("insert..."); // Commit the transaction connection.commit(); // Release the connection connection.release();
関連項目