This adapter queries the the database and returns a ValueList of DynaBean(s).
Name | Required | Default | Description |
---|---|---|---|
adapterType | N | 0 |
A bitwise OR of the following:
|
dataSource | Y | N/A | An instance of javax.sql.DataSource. |
sql | Y | N/A | The sql query. |
defaultNumberPerPage | N | Integer.MAX_VALUE | The number if items per page. This can be overridden by a value in the ValueListInfo. |
defaultSortColumn | N | N/A | The column to sort the results by. This can be overridden by a value in the ValueListInfo. |
defaultSortDirection | N | N/A | The direction (asc or desc) to sort the results by. This can be overridden by a value in the ValueListInfo. |
useName | N | true |
|
validator | N | null |
|
You will notice the SQL in the <sql> tag is not valid SQL. The line: /~sortColumn: ORDER BY [sortColumn] [sortDirection]~/ contains chars '/', '~', '[' and ']'; all invalid chars in thier context. Let me explain what is hapening here.
The DefaultDynAdapter uses the values in the ValueListInfo.filters to dynamically build the query. The following rules are applied.
'ORDER BY [sortColumn] DESC' = 'ORDER BY my_sorted_column DESC'
'WHERE user.name = {name}' = 'WHERE user.name = ?'