Like End With methods
Definition
The Like End With methods allow you to add the LIKE operator to the query. Additionally, the object or value that is received by parameter will be concatenated with the % character at the beginning.
The methods available in Normal method name and the Short method name versions are:
Normal method name | Short method name | SQL to generate |
---|---|---|
likeEndWith | lkew | leftOp LIKE CONCAT('%', rightOp) |
notLikeEndWith | nlkew | NOT (leftOp LIKE CONCAT('%', rightOp)) |
For all cases, the object that calls Like Any methods will be placed as the operand on the left side of the LIKE operator and the object or value received by parameter will be placed on the right side of the LIKE operator.
1. likeEndWith | lkew
leftOperand LIKE CONCAT('%', rightOperand)
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, String
, KValTextField
, KOptionalKColumn
, KOptionalString
, KOptionalKValTextField
.
Example: lkew(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lkew(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name LIKE CONCAT('%', au.last_name)
Parameters:
- None
Example: lkew(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lkew("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name LIKE ?1
Parameters:
- ?1: "%Jhon"
Example: lkew(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.lkew(optional(nullValue)))
.and(APP_USER.FIRST_NAME.lkew(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE au.first_name LIKE ?1
Parameters:
- ?1: "%Jhon"
2. notLikeEndWith | nlkew
NOT (leftOperand LIKE CONCAT('%', rightOperand))
This method takes a single parameter and the possible values are:
KTableColumn
, KColumn
, String
, KValTextField
, KOptionalKColumn
, KOptionalString
, KOptionalKValTextField
.
Example: nlkew(KColumn)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlkew(APP_USER.LAST_NAME))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name LIKE CONCAT('%', au.last_name))
Parameters:
- None
Example: nlkew(String)
Java code:
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlkew("Jhon"))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name LIKE ?1)
Parameters:
- ?1: "%Jhon"
Example: nlkew(KOptionalString)
Java code:
final String nullValue = null;
k
.select(APP_USER.ID)
.from(APP_USER)
.where(APP_USER.FIRST_NAME.nlkew(optional(nullValue)))
.and(APP_USER.FIRST_NAME.nlkew(optional("Jhon")))
.multiple();
SQL generated:
SELECT au.id
FROM app_user au
WHERE NOT (au.first_name LIKE ?1)
Parameters:
- ?1: "%Jhon"