com.ibm.pdq.annotation
Annotation Type JoinColumn
@Target(value={METHOD,FIELD})
@JoinPoint
annotation.
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 only within the @JoinPoint
annotation.
See the IBM InfoSphere 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 @JoinColumn
annotation in which the value of the table
element is not "*".
If the resulting Property name within the nested bean does not match the value of the name
and
table
elements then propertyName
must be coded.
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.
Required Element Summary
Modifier and Type | Required Element and Description |
---|---|
name
Specifies the label of the database column that the property represents.
|
Optional Element Summary
Modifier and Type | Optional Element and Description |
---|---|
propertyName
Specifies the Property name of the nested bean..
|
|
table
Specifies the name of the database table of the column represented by the annotated property.
|
Required Element Detail
name
public abstract String name
Optional Element Detail
propertyName
public abstract String propertyName
name
element is also the Property name in the nested bean that will be updated from this column in
the ResultSet
table
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 may map columns to
properties incorrectly.
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.