sf logo

sf.qof
Annotation Type Query


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface Query

Defines a query method. Query methods normally use SQL select statements.

 @Query(sql = "select id {int%%1}, name {%%.name} from person where id = {%1}")
 Person getPerson(int id);
 
 @Query(sql = "select id {%%.id,%%*}, name {%%.name} from person where id = {%1}")
 Map<Integer, Person> getPerson(int id);
 

{%%.name} defines a result mapping to the setter setName on Person
{%%*} defines a the map ket for the colletion type Map using id
{int%%1} defines a result mapping to the first parameter of the constructor of Person
{%1} defines a parameter mapping to the primitive type parameter id

Allowed return types of the query method are:

See Also:
SqlParser

Required Element Summary
 String sql
          This is the SQL statement.
 

Element Detail

sql

public abstract String sql
This is the SQL statement.

Returns:
SQL statement
See Also:
SqlParser

sf logo

Copyright © 2007 brunella ltd. All Rights Reserved.