com.ibm.pdq.annotation
Annotation Type ColumnOverride
@Target(value=TYPE) @Retention(value=RUNTIME) public @interface ColumnOverrideFor queries against databases, indicates that a property in the pureQuery bean represents a particular column.
The column that is specified for a property in a @ColumnOverride
annotation overrides any other
column that is specified for the same property. This override applies to the columns that are specified by the
standard pureQuery mapping, and to the columns that are specified by the @Column
annotation. This override also applies to the columns that are specified in the pureQuery bean class for
which the annotation is specified, and to the columns that are specified in the superclasses of the class. This
annotation is intended to override a @Column
annotation that is provided for a property, but it
indicates a property-to-column mapping whether a @Column
annotation is present.
The @ColumnOverride
annotation does not specify table names, and as a result, it removes any
table
element value that was set by an overridden
@Column
annotation.
If more than one @ColumnOverride
annotation is wanted for a single pureQuery bean class, the
@ColumnOverrides
annotation must be used.
The following example illustrates how a property-to-column mapping can be specified by using
@ColumnOverride
:
@ColumnOverride(propertyName = "departmentName", column = "DEPTNAME")
public class Department {
. . .
}
Required Element Summary
Modifier and Type | Required Element and Description |
---|---|
column
Specifies the label of the database column that the property represents.
|
|
propertyName
Specifies the name of a property.
|
Required Element Detail
column
public abstract String column
propertyName
public abstract String propertyName
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.