Spring Data – Multi-column searches
Here is sample of such Specification for User: public static Specification<User> containsTextInName(String text) { if (!text.contains(“%”)) { text = “%” + text + “%”; } String finalText = text; return (root, query, builder) -> builder.or( builder.like(root.get(“lastname”), finalText), builder.like(root.get(“firstname”), finalText) ); } or even more customizable implementation: public static Specification<User> containsTextInAttributes(String text, List<String> attributes) { if … Read more