Less Than methods
Definition
The Less Than methods allow you to add the < operator to the query.
The methods available in Normal method name and the Short method name versions are:
| Normal method name | Short method name | SQL to generate |
|---|---|---|
| lessThan | lt | leftOp < rightOp |
| iLessThan | ilt | LOWER(leftOp) < LOWER(rightOp) |
| notLessThan | nlt | NOT (leftOp < rightOp) |
| notILessThan | nilt | NOT (LOWER(leftOp) < LOWER(rightOp)) |
For all cases, the object that calls Less Than methods will be placed as the operand on the left side of the < operator and the object or value received by parameter will be placed on the right side of the < operator.
1. lessThan | lt
leftOperand < rightOperand
This method takes a single parameter and the possible values are:
KTableColumn, KColumn, Number, String, LocalDate, LocalDateTime, KValNumberField, KValTextField, KQuery, KOptionalKColumn, KOptionalNumber, KOptionalString, KOptionalLocalDate, KOptionalLocalDateTime, KOptionalKValNumberField, KOptionalKValTextField, KOptionalLong.
If the object received by parameter is a KQuery, it will be treated as a subquery and you must ensure that it returns only one column comparable to the operand on the left side of the condition.
Example: lt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name < au.last_name
Parameters:
- None
Example: lt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name < ?1
Parameters:
- ?1: "Jhon"
Example: lt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.lt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name < ?1
Parameters:
- ?1: "Jhon"
Example: lt(KQuery)
Java code:
final KQuery subquery =
k
.select(max(APP_USER_SPECIALTY.APP_USER_ID))
.from(APP_USER_SPECIALTY);
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.ID.lt(subquery))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.id < (
SELECT MAX(aus.app_user_id)
FROM app_user_specialty aus
)
Parameters:
- None
2. iLessThan | ilt
LOWER(leftOperand) < LOWER(rightOperand)
This method takes a single parameter and the possible values are:
KTableColumn, KColumn, String, KValTextField, KOptionalKColumn, KOptionalString, KOptionalKValTextField.
Example: ilt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ilt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) < LOWER(au.last_name)
Parameters:
- None
Example: ilt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ilt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) < ?1
Parameters:
- ?1: "jhon"
Example: ilt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.ilt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.ilt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE LOWER(au.first_name) < ?1
Parameters:
- ?1: "jhon"
3. notLessThan | nlt
NOT (leftOperand < rightOperand)
This method takes a single parameter and the possible values are:
KTableColumn, KColumn, Number, String, LocalDate, LocalDateTime, KValNumberField, KValTextField, KQuery, KOptionalKColumn, KOptionalNumber, KOptionalString, KOptionalLocalDate, KOptionalLocalDateTime, KOptionalKValNumberField, KOptionalKValTextField, KOptionalLong.
If the object received by parameter is a KQuery, it will be treated as a subquery and you must ensure that it returns only one column comparable to the operand on the left side of the condition.
Example: nlt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name < au.last_name)
Parameters:
- None
Example: nlt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name < ?1)
Parameters:
- ?1: "Jhon"
Example: nlt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.nlt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name < ?1)
Parameters:
- ?1: "Jhon"
Example: nlt(KQuery)
Java code:
final KQuery subquery =
k
.select(max(APP_USER_SPECIALTY.APP_USER_ID))
.from(APP_USER_SPECIALTY);
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.ID.nlt(subquery))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (
au.id < (
SELECT MAX(aus.app_user_id)
FROM app_user_specialty aus
)
)
Parameters:
- None
4. notILessThan | nilt
NOT (LOWER(leftOperand) < LOWER(rightOperand))
This method takes a single parameter and the possible values are:
KTableColumn, KColumn, String, KValTextField, KOptionalKColumn, KOptionalString, KOptionalKValTextField.
Example: nilt(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nilt(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) < LOWER(au.last_name))
Parameters:
- None
Example: nilt(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nilt("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) < ?1)
Parameters:
- ?1: "jhon"
Example: nilt(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nilt(optional(nullValue)))
.and(APP_USER.FIRST_NAME.nilt(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (LOWER(au.first_name) < ?1)
Parameters:
- ?1: "jhon"