Annotation Interface SqlQuery


@Target(METHOD) @Retention(RUNTIME) public @interface SqlQuery

Annotates a DAO method to mark it as a query that returns results. Typically, a SELECT, but could be an update with a RETURNING clause.

Exactly one of the 'value' or 'sql' parameters must be set, and will contain the SQL statement.

The method parameters and return types must be "supported types" TODO link The method parameter names must match placeholder names in the SQL statement, unless a method parameter is a Record, in which case record component names may match placeholder names.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
     
    When the return type of the method is Map, this is the column name to use as the Map key.
     
    Alias for "sql"
    When the return type of the method is Map, this is the column name to use as the Map value.
  • Element Details

    • value

      @Language("SQL") String value
      Alias for "sql"
      Default:
      ""
    • sql

      @Language("SQL") String sql
      Default:
      ""
    • keyColumn

      String keyColumn

      When the return type of the method is Map, this is the column name to use as the Map key. It is an error to set this if the return type is not Map.

      If the Map key type is a Record, the columns will be matched by the record component names.

      This may also be omitted if there is a column with literal name "key".

      Default:
      ""
    • valueColumn

      String valueColumn

      When the return type of the method is Map, this is the column name to use as the Map value. It is an error to set this if the return type is not Map.

      If the Map value type is a Record, the columns will be matched by the record component names.

      This may also be omitted if there is a column with literal name "value".

      Default:
      ""
    • fetchSize

      int fetchSize
      Default:
      -2147483648