(a) Function
Sets whether or not the following classes are to be valid after commit execution when HiRDB commits:
- ResultSet class
- Statement class, PreparedStatement class, and CallableStatement class
(b) Format
public void setCommit_Behavior (String type)
(c) Argument
- String type
- Sets whether or not the objects of the Statement class, PreparedStatement class, CallableStatement class, and ResultSet class remain valid even after a transaction terminates.
Specification value |
ResultSet class |
Statement class, PreparedStatement class, CallableStatement class |
DELETE (default value) |
Invalid#1 |
Invalid#2 |
CLOSE |
Invalid#1 |
Valid |
PRESERVE |
Valid#3 |
Valid#3 |
- #1: The condition that invalidates objects of the ResultSet class after commit execution is that the getXXX method of the ResultSet class can be executed by executing the following methods of the ResultSet class:
- next method
- first method
- last method
- absolute method
- relative method
- Correct execution of a method using objects of a ResultSet class that was invalidated is not guaranteed.
- #2: Objects that are invalid after commit execution include the following:
- SQL statements precompiled by the Connection.prepareStatement method
- SQL statements precompiled by the Connection.prepareCall method
- ResultSet class objects acquired by the executeQuery method of the Statement class, PreparedStatement class. or CallableStatement class.
- #3: If the version of the connected HiRDB is earlier than 07-01, using LOCK TABLE to lock the table is required.
(d) Return value
None.
(e) Functional detail
Sets whether or not the objects of the Statement class, PreparedStatement class, CallableStatement class, and ResultSet class remain valid even after the transaction terminates. If this method is not called, the default is DELETE.
Executing this method is equivalent to setting the COMMIT_BEHAVIOR property that is performed when a database is connected using DriverManager.
(f) Exception that occurs
When XADataSource is used for the connection, DELETE always results, regardless of the specified value. However, getCommit_Behavior returns the value specified in the type argument.
For notes, see Notes on COMMIT_BEHAVIOR following Table 17-3.
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.