I want use the spring JPA specification join function
This is my code for the tables:
- Table InStudent
Table InParent
public static Specification<InStudent> filterByKeywordAndStatus(final String keyword) { return (Root<InStudent> root, CriteriaQuery<?> query, CriteriaBuilder cb) -> { List<Predicate> predicates = new ArrayList<>(); if (StringUtils.hasText(keyword)) { predicates.add( cb.or( cb.like(root.get(InStudent_.name), "%" + keyword + "%"), cb.like(root.get(InStudent_.address), "%" + keyword + "%"), cb.like(root.get(InStudent_.phone), "%" + keyword + "%") ) ); } return cb.and(predicates.toArray(new Predicate[predicates.size()])); };
}
How can I join table inStudent and inParent within the specification?