org.apache.beehive.controls.system.jdbc
Annotation Type JdbcControl.SQL


@Inherited
@Retention(value=RUNTIME)
@Target(value=METHOD)
public static @interface JdbcControl.SQL

Method-level annotation for methods in a jcx which wish to access a database instance.


Required Element Summary
 String statement
          The SQL statement to send to the database.
 
Optional Element Summary
 int arrayMaxLength
          Maximum array length.
 boolean batchUpdate
          Execute the SQL statement as a batch update.
 JdbcControl.FetchDirection fetchDirection
          Specify the fetch direction for the ResultSEt.
 int fetchSize
          Specify the fetch size for the ResultSet.
 int[] generatedKeyColumnIndexes
          Specify generated key columns by column number to return when the getGeneratedKeys element is true.
 String[] generatedKeyColumnNames
          Specify generated key columns by column names to return when the getGeneratedKeys element is true.
 boolean getGeneratedKeys
          Return the generated key values generated by the SQL statement.
 Class iteratorElementType
          Specify the type of element to be interated over when the method's return type is java.util.Iterator.
 int maxRows
          Max number of ResultSet rows to return.
 JdbcControl.HoldabilityType resultSetHoldabilityOverride
          Specify the holdability type for the annotated method.
 Class resultSetMapper
          Specify a custom result set mapper for the ResultSet generated by the SQL statement.
 JdbcControl.ScrollType scrollableResultSet
          Specify that the ResultSet returned by the method is scrollable.
 JdbcControl.TypeMapper[] typeMappersOverride
          Specifies type mappings for SQL user defined types (UDTs).
 

Element Detail

statement

public abstract String statement
The SQL statement to send to the database. Required annotation element.

arrayMaxLength

public abstract int arrayMaxLength
Maximum array length. This element has no effect on the call unless the method return type is an array. Optional element.

Default:
1024

maxRows

public abstract int maxRows
Max number of ResultSet rows to return. If used with arrayMaxLength the smaller value is used. Optional element, default value is no limit on number of rows returned.

Default:
0

batchUpdate

public abstract boolean batchUpdate
Execute the SQL statement as a batch update. Methods which have this element set to true must return an array of ints. Optional element, defaults to false.

Default:
false

fetchSize

public abstract int fetchSize
Specify the fetch size for the ResultSet. Optional element, defaults to 0.

Default:
0

fetchDirection

public abstract JdbcControl.FetchDirection fetchDirection
Specify the fetch direction for the ResultSEt. Optional element, defaults to FORWARD.

Default:
FORWARD

getGeneratedKeys

public abstract boolean getGeneratedKeys
Return the generated key values generated by the SQL statement. Optional element, defaults to false.

Default:
false

generatedKeyColumnNames

public abstract String[] generatedKeyColumnNames
Specify generated key columns by column names to return when the getGeneratedKeys element is true. May only be set if getGeneratedKeys is set to true, otherwise a compile time error is generated. Optional element.

Default:
{}

generatedKeyColumnIndexes

public abstract int[] generatedKeyColumnIndexes
Specify generated key columns by column number to return when the getGeneratedKeys element is true. May only be set if getGeneratedKeys is set to true, otherwise a compile time error is generated Optional element.

Default:
{}

resultSetHoldabilityOverride

public abstract JdbcControl.HoldabilityType resultSetHoldabilityOverride
Specify the holdability type for the annotated method. Overrides the holability annotation element of the ConnectionOptions annotation. The holdability type will be in effect for the duration of this method call. Optional, defaults to DRIVER_DEFAULT.

Default:
DRIVER_DEFAULT

typeMappersOverride

public abstract JdbcControl.TypeMapper[] typeMappersOverride
Specifies type mappings for SQL user defined types (UDTs). Any type mappings set here will be used by the underlying JDBC Connection for UDT type mappings. These type mappings will REPLACE any set on the JDBC connection for the duration of the method call. Optional element.

Default:
{}

iteratorElementType

public abstract Class iteratorElementType
Specify the type of element to be interated over when the method's return type is java.util.Iterator. Optional element.

Default:
org.apache.beehive.controls.system.jdbc.JdbcControl.UndefinedIteratorType.class

resultSetMapper

public abstract Class resultSetMapper
Specify a custom result set mapper for the ResultSet generated by the SQL statement. ResultSet mappers must extend the ResultSetMapper abstract base class. If a value is specified it will be used to map the ResultSet of the query to the return type of the method. See org.apache.beehive.controls.system.jdbc.ResultSetMapper for additional information. Optional element.

Default:
org.apache.beehive.controls.system.jdbc.JdbcControl.UndefinedResultSetMapper.class

scrollableResultSet

public abstract JdbcControl.ScrollType scrollableResultSet
Specify that the ResultSet returned by the method is scrollable. Valid only for methods which return a ResultSet, otherwise a compile-time error will occur. Valid element values are defined by the ScrollType enumeration. Optional element, defaults to JDBC driver's default setting.

Default:
DRIVER_DEFAULT