I have a complex query e.g. search employees with name, age, address, etc
I would like to append a WHERE
clause if a parameter IS NOT NULL
.
for example (pseudo code):
if (age != null) // then append age to the where clause
whereClause += whereClause + AND age = :age"
I would like to use a NamedQuery
in an XML
file, but a NamedQuery
does not support conditional where like myBatis
Can anyone help me resolve this problem?