|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||
@Retention(value=SOURCE) @Target(value=LOCAL_VARIABLE) public @interface PrepareKey
Annotation for local variables marking PreparedStatement to be generated. SQL query is taken from preceding javadoc comments.
Example:
String messageText = ...;
/**
* INSERT INTO LOG (MESSAGE) VALUES (:messageText)
*/
@PrepareKey("id") PreparedStatement stmt = null;
executeUpdate(stmt);
int id = getGeneratedKeys()[0].intValue();
Preprocessor generates code required to prepare statement with given auto-generated columns and set its parameters.
Note that parameters referenced
in query (as :paramName) should be accessible as variables in the current scope.
You can use string and query substitution in comments, see Query.
| Optional Element Summary | |
|---|---|
java.lang.String |
value
Comma-separated list of column names which are auto-generated by the statement. |
public abstract java.lang.String value
Note that upper/lower case may be significant (depends on DB).
Generated key values can be retrieved by GBase.getGeneratedKeys(java.sql.PreparedStatement) method,
which returns array of generated key values - one value for each given column (order of columns is preserved
if the value was specified).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | ||||||||