Specifies the SQL statement and associated attributes that correspond to a method in a Database control.
Note: The @jc:sql annotation appears in Database controls with the .jcx extension. Database controls with the .ctrl extension, which were created in a previous version of WebLogic Workshop, use the @jws:sql annotation. Controls with the .ctrl extension continue to be supported in WebLogic Workshop.
@jc:sql
statement="sqlStatement"
[iterator-element-type="javaType"]
[array-max-length=integer OR "all"]
[max-rows="integer"]
[command-type="grid | detail | update | delete | insert | templateRow | insertedRow"]
[rowset-name]
Required. The SQL (Structured Query Language) statement that will be executed when the associated Database control method is invoked. The statement may contain substitutions of the form {varName}, where paramName is a parameter of the Database control method (or a member accessible from the parameter).
If the statement is a single line, it may be formatted with and equals sign and quotes, as follows:
/** * @jc:sql statement="SELECT * FROM sometable" */ public HashMap getEverything();
If the statement spans multiple lines, it is delimited with :: (two colons), as follows:
/** * @jc:sql statement:: * SELECT name * FROM employees * WHERE name LIKE {partialName} * :: */ public String[] partialNameSearch(String partialName);
For a discussion of parameter substitution in the statement attribute, see Parameter Substitution in @jc:sql Statements.
Required if Database control method return type is java.util.Iterator. Specifies the underlying class of the Iterator that will be returned by the Database control method. The class must meet specific criteria that are described in the Returning an Object section of Returning a Single Row from a Database Control Method.
Optional. If the return type of the associated Database control method is an array, specifies the maximum size of the array that will be returned. This attribute can be used to set an upper limit on memory usage by a Database control method.
Default value: 1024
Note that if the associated query returns more rows than specified by array-max-length, there is no way to access the excess rows.
The special value all causes all rows that satisfy the query to be returned. Note that this can possibly exhaust all available memory if not used carefully.
If you wish to limit memory usage, you should return an Iterator or a ResultSet. However, these data types cannot be returned directly to a Page Flow or web service file. To learn about returning Iterators and ResultSets from a Database control method, see Returning Multiple Rows from a Database Control Method.
Optional. Sets the maximum number of records to be returned by the query. The max-rows attribute limits the size of all types of data sets, including Arrays, RowSets, etc. This attribute cannot be set dynamically at runtime. It is a fixed value that can be set only at design time. For detailed information on setting the maximum number of records dynamically at runtime, see the Help topic Limiting the Size of Returned Data.
Optional. Possible values are grid, detail, update, delete, insert, templateRow, insertedRow.
The command-type attribute is used by RowSet controls, which are a special type of Database control. To learn more about RowSet controls, see RowSet Control.
Required. This value must match the name of the top level tag of the XML returned by this control file.
The rowset-name attribute is used by RowSet controls, which are a special type of Database control. To learn more about RowSet controls, see RowSet Control.
The following rules apply to this annotation's use: