以下代码对于Spring boot org.springframework.boot 版本 2.0.3.RELEASE 来说工作得很好,在这里我尝试应用 IN 条款。
//导入
import org.springframework.context.annotation.DeferredImportSelector.Group;
import javax.persistence.criteria.Predicate;
//代码
final Collection<Predicate> predicates = new ArrayList<>();
...
final Path<Group> group = root.<Group> get("countryId");
predicates.add(group.in(selected_country_ids));
但是,Group似乎无法在 org.springframework.boot 版本 1.5.10.RELEASE
中运行