按年份从表中列出,年份为字符串

时间:2019-12-03 13:57:45

标签: java hibernate jpa

我有一个项目,其中dao正在使用规范。我需要按年份获得大于某个实体的列表。我为此编写了规范,但是方法无法正常工作:

% pyinstaller --add-data my_file.db:. --add-data another_file.json:. /directory/to/your/code/script.py

年是表中的public static Specification<Entity> YearEqualTo(String year, boolean isBefore) { return new Specification<Entity>() { @Override public boolean isSatisfied(Entity obj) { return false; } @Override public Predicate toPredicate(Root<Entity> root, CriteriaBuilder builder) { if (isBefore) return builder.lessThan(root.get("year"), year); return builder.greaterThanOrEqualTo(root.get("year"), year); } }; } 。如何正确执行?

0 个答案:

没有答案