|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface Update
Used in an interface to indicate to the pureQuery Generator that the annotated declared method runs an SQL INSERT, UPDATE, DELETE, or DDL statement. The SQL statement can be specified in the
@Update annotation, and it must not return any ResultSets. See the IBM Optim pureQuery Runtime documentation for details about how to specify SQL statements for annotated methods. When the
pureQuery Generator is invoked for an interface, it generates an implementation class for the interface. The generated version of a method that is annotated with @Update runs the
specified SQL statement.
| Data Type | Element Name and Description |
|---|---|
String |
patternFor future enhancement. |
String |
positionedCursorNameIndicates that the SQL statement is a positioned UPDATE or DELETE statement for an updatable cursor, and provides the name of that cursor. |
String |
sqlIndicates the SQL INSERT, UPDATE, DELETE, or DDL statement to run when the implemented version of the annotated method is invoked. |
String |
valueIndicates the SQL INSERT, UPDATE, DELETE, or DDL statement to run when the implemented version of the annotated method is invoked. |
public abstract String pattern
public abstract String positionedCursorName
Annotated methods can run positioned UPDATE and DELETE statements for updatable cursors. This is done by declaring in a single interface a method that defines an updatable cursor and
one or more annotated methods that define positioned UPDATE or DELETE statements for that cursor. The annotated method that defines the cursor must have the @Select annotation and the @Cursor annotation. The annotated methods that define the positioned UPDATE
and DELETE statements must have the @Update annotation. The value of the @Cursor(cursorName=...) attribute on the method that defines the cursor must be the same as the values of
the @Update(positionedCursorName=...) attributes on the methods that define the positioned UPDATE and DELETE statements.
When the positionedCursorName attribute is specified for an annotated method, the SQL statement must be an SQL UPDATE statement or an SQL DELETE statement. The SQL
statement must not contain a "WHERE" clause. pureQuery adds a "WHERE CURRENT OF cursorName" clause to the SQL statement.
Whenever an annotated method has a positioned cursor name cursorName provided in the @Update(positionedCursorName=...) attribute, another annotated method must be
declared with the following characteristics:
@Select annotation.@Cursor annotation with the cursor attribute set to the cursorName.Iterator or ResultSet.Iterator or ResultSet query
result.
This is an example of a declaration of an annotated method that defines an updatable cursor:
@Select(sql = "SELECT * FROM EMPLOYEE")
@Cursor(cursorName = "EMPLOYEECURSOR", concurrency = java.sql.ResultSet.CONCUR_UPDATABLE)
Iterator<EmployeeBean> selectAllEmployees ();
This is an example of a declaration of an annotated method that defines a positioned UPDATE statement for the updatable cursor:
@Update(sql = "UPDATE EMPLOYEE SET workdept = ?1.departmentNumber", positionedCursorName = "EMPLOYEECURSOR")
int updateEmployeeDepartment (EmployeeBean employeeBean);
public abstract String sql
public abstract String value
Note: value= does not need to be explicitly provided. For example, the SQL statement can be specified as: @Update("DELETE FROM
DEPARTMENT").
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||