How can I use a filter with the CONTAINS operation on the concatenation of 2 columns?

I have a student entity that includes a person entity as a column. The person entity has two columns: last name and first name. In the student list view, I need to apply a filter using the CONTAINS operation on the concatenation of the last name and first name columns from the person entity.

If you need this condition in a genericFilter, create a JPQL condition (Add condition → Create → Create JPQL condition) with concat({E}.person.firstName, {E}.person.lastName) like ? where clause:

image

You can also define it at design time as explained in Declarative Configuration.

The resulting JPQL will be like this:

select e from Student e 
where concat(e.person.firstName, e.person.lastName) like ?1

Regards,
Konstantin

1 Like