String title = bookSearchCriteria.getTitle().toUpperCase();
predicates.add(builder.like(builder.upper(book.<String> get("title")), "%" + title + "%"));
}
if (bookSearchCriteria.getCategory() != null) {
Category category = this.entityManager.find(Category.class, bookSearchCriteria.getCategory().getId());
predicates.add(builder.equal(book.<Category> get("category"), category));
}
if (!predicates.isEmpty()) {
query.where(predicates.toArray(new Predicate[predicates.size()]));