Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by alex valuiskyi for Criteria API concat 3 fields value

You can add field annotated with @Formula to the entity

@Formula("concat(fam, name, otch)")
private String fullName;

where fam, name, otch are columns names.

And use it this way

Predicate predicate  = criteriaBuilder.like(teacherRoot.get("fullName"),"%" + str + "%");

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles