net.sf.eodsql
Annotation Type Select


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

The @Select annotation is used to mark methods within a Query class that will return a DataSet. The Select annotation contains the SQL query that will be executed on the database, and whether the resulting DataSet will be a "connected" or "disconnected" DataSet to start with. Remember that a DataSet may be cleanly disconnected from the database.

Here is an example of how a @Select is used:

        public class User {
            public Integer id;
            public String username;
        }
        
        public interface UserQuery extends BaseQuery {
            @Select("SELECT * FROM user WHERE id = ?1")
            public DataSet<User> getUserById(int id);
        }
    
Any method annotated with @Select may return any one of the following datatypes:

Columns that cannot be mapped to fields are ignored, as are fields that cannot be mapped to columns. @Select SQL uses the exact same query parser as the Update annotation, and so can also accept complex types as it's parameters, and insert their fields into the SQL query.

Author:
jason
See Also:
Update

Optional Element Summary
 boolean disconnected
          Specify whether or not the DataSet resulting from a call to the annotated method will be connected to the database or not.
 boolean rubberstamp
          If rubberstamp is flagged as true, the annotated method must return a DataIterator, otherwise it will be rejected by the QueryTool.
 String sql
          The SQL query to execute on the database.
 String value
          The SQL query to execute on the database.
 

value

public abstract String value
The SQL query to execute on the database. The result set of the query will be mapped to the datatype specified in the method declaration.

See Also:
sql()
Default:
""

sql

public abstract String sql
The SQL query to execute on the database. The result set of the query will be mapped to the datatype specified in the method declaration. This value works in the exact same way as value(), but is used when you wish to specify values other than the SQL query.

Default:
""

disconnected

public abstract boolean disconnected
Specify whether or not the DataSet resulting from a call to the annotated method will be connected to the database or not.

See Also:
DataSet, DataSet.disconnect()
Default:
false

rubberstamp

public abstract boolean rubberstamp
If rubberstamp is flagged as true, the annotated method must return a DataIterator, otherwise it will be rejected by the QueryTool. Rubberstamping will cause the returned DataIterator to use a single instance of the data-object for all of the rows returned, instead of initializing a new one for each row. This can be used to save CPU time and memory, and is especially useful in display code.

Default:
false