Beehive Integration in WebLogic Server 9.0
Annotation for Rowsets
SQLRowSet
The SQLRowSet metadata annotation has been added in WebLogic Server 9.0. SQLRowSet is a method-level annotation that supports RowSet functionality. It has the following members.
SQLRowSet Members
Member Name
|
Type
|
Required
|
Use
|
Values
|
commandType
|
CommandType
|
No
|
RowSet command to execute
|
CommandType.NONE (default)
CommandType.GRID
CommandType.DETAIL
CommandType.UPDATE
CommandType.INSERT
CommandType.DELETE
CommandType.TEMPLATE_ROW
CommandType.INSERTED_ROW
CommandType.NEW_KEY
|
rowsetName
|
String
|
No
|
Name of RowSet object
|
Default: empty string
|
rowsetSchema
|
String
|
No
|
XML schema name
|
Default: empty string
|
Example
The sample code described in this section is intended to be included in a JDBC control file. For information about such files, see http://beehive.apache.org.
Include the following code in your control file:
@SQLRowSet(commandType = com.bea.control.JdbcControl.CommandType.NONE, rowsetName="aRowSet")
@JdbcControl.SQL(statement="SELECT * FROM WEBLOGIC.VISITORS_CONTROL")
public RowSet getRowSet() throws SQLException;
Suppose your control file is named JdbcControlSample.jcx
. An instantiable Java class named JdbcControlSample.class
will be generated, containing a method named getRowSet()
that returns a RowSet object populated with the results of executing the SQL statement shown in the sample code.
You could use this functionality as follows:
@Control() protected JdbcControlSample myCtl;
try {
RowSet rs = myCtl.getRowSet();
. . .
} catch (Exception e) {
. . .
}
Usage Restrictions
The following rules govern the use of this annotation:
- If the annotation for a method specifies CommandType.INSERT, CommandType.UPDATE, or CommandType.DELETE, then the method must have a RowSet as its first parameter.
- If the annotation for a method specifies CommandType.INSERT, then the RowSet must contain at least one inserted row. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.INSERT, then the RowSet must not contain any deleted or updated rows. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.DELETE, then the RowSet must contain at least one deleted row. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.DELETE, then the RowSet must not contain any inserted or updated rows. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.UPDATE, then the RowSet must contain at least one updated row. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.UPDATE, then the RowSet must not contain any inserted or deleted rows. Otherwise, the method call will throw a ControlException.
- If the annotation for a method specifies CommandType.TEMPLATE_ROW, then the RowSet must not have been assigned a name by a previous call to the JDBC control. Otherwise, the method call will throw an exception. In addition, the method must return a RowSet object.