|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface Column
For queries against databases, indicates that the annotated property represents the described column.
When populating a pureQuery bean with the contents of a query result row, pureQuery attempts to match the column label found in the query results (as indicated by ResultSetMetaData.getColumnLabel(int)
) with
the properties in the pureQuery bean. By default, pureQuery assumes that a property represents a column with a label that matches (without respect to case) the property name. pureQuery assumes
that the SQL query result only contains one column with that name. When this mapping is correct, no further notation of the column mapping is required. When a property name does not match
(without respect to case) the represented column, or when a column name appears more than once in a query result, this annotation can be used to indicate which column the property represents.
This annotation can be used on fields and accessor methods for properties when the fields and methods are public. pureQuery ignores the @Column
annotation everywhere else.
See the IBM Optim pureQuery Runtime documentation for a description of how property names are determined.
If a query result contains multiple columns with the same label, pureQuery cannot correctly map the columns to properties unless each property that represents a column with a duplicated label
has a @Column
annotation in which the value of the table
element is not "*".
The column mapping is also undefined if a query result contains two columns that have identical labels and identical table names. If this occurs, aliases should be provided in the SQL statement (for example, by using the "AS" clause) to change the label of at least one of the columns.
Data Type | Element Name and Description |
---|---|
String |
name Specifies the label of the database column that the property represents. |
Data Type | Element Name and Description |
---|---|
String |
table Specifies the name of the database table of the column represented by the annotated property. |
Element Detail |
---|
public abstract String name
The label of a column is the value returned by ResultSetMetaData.getColumnLabel(int)
. It is the name of the column, unless the SQL statement specifies an alias for the column (for
example, by using the "AS" clause), in which case it is the alias.
public abstract String table
name
element appears only once in the query result, and that the annotated property represents that column,
regardless of which table it is in.
If this element is either not provided, or if it is provided with a value of "*", and the query result contains more than one column with the label indicated by the
name
element, then pureQuery cannot map columns to properties.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |