@Retention(value=RUNTIME)
@Target(value=ANNOTATION_TYPE)
public @interface WhereField
Where
annotation.Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
name
Name of row member involved in where condition.
|
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
booleanOperator
SQL boolean operator to use preceding this field.
|
java.lang.String |
comparisonOperator
SQL comparison operator to use in condition "column-name comparisonOperator ?".
|
java.lang.String |
operand
SQL to use as operand following comparison operator.
|
public abstract java.lang.String name
public abstract java.lang.String booleanOperator
public abstract java.lang.String comparisonOperator
When comparison operator is "IN" then the condition used is
"column-name IN (?, ?, ...)" and the corresponding parameter supplied by
SqlOperation.setParameters(Object...)
may be a Collection
. The
number of ? parameter placeholders within the parentheses will be equal
to the size of the collection.
Any SqlOperation
that uses a WhereField
with a comparison operator of "IN"
will be prepared each time it is executed, SqlOperation.execute()
since the
number of parameters within the IN phrase may be different from previous execution.
"IN" operator may be used with with other operators within the same Where
annotation. Multiple "IN" operators may be used within same Where
annotation.
public abstract java.lang.String operand
Operand can be a constant, for example:
@Where(name="hasInventory", whereFields=@WhereField(name="quantity", comparisonOperator=">", operand="0"))
If operand is "?", then the parameter for the field will be obtained
from row object as set with ScalarSelectOperation.setRowParameters(Object)
or
parameter set with SqlOperation.setParameters(Object...)
.