The following table lists the Select annotation elements.
Element | Type | Accessibility |
sql or value | String | The SQL statement to be executed |
tableName | String | The name of the table that will be updated when the DataSet.sync method is called |
readOnly | boolean | Indicates the returned DataSet is read-only |
connected | boolean | Indicates if the DataSet is connected to the data source |
allColumnsMapped | boolean | Indicates if there is a one-to-one mapping between the column names in the SQL statement and the fields in the returned DataSet |
scrollable | boolean | Indicates if the returned DataSet is scrollable. This element only takes effect only when in connected mode. |
import java.sql.BaseQuery;
import java.sql.DataSet;
import java.sql.Select;
public interface UserQueries extends BaseQuery {
// Select all users
@Select (sql ="SELECT userId, firstName, lastName FROM Users",
readOnly=false, connected=false, tableName="Users")
DataSet<User> getAllUsers ();
// Select user by name */
@Select (sql ="SELECT userId, firstName, lastName FROM Users"
+ "WHERE userName=?", readOnly=false, connected=false,
tableName ="Users")
DataSet<User> getUserByName(String userName);
}