Hibernate Spring Jpa-带日期的存储库调用
之前Hibernate Spring Jpa-带日期的存储库调用,hibernate,java-8,spring-data-jpa,Hibernate,Java 8,Spring Data Jpa,之前 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [2018-07-31] did not match expected type [java.time.LocalDate (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [2018-07-31] did not match ex
org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [2018-07-31] did not match expected type [java.time.LocalDate (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [2018-07-31] did not match expected type [java.time.LocalDate (n/a)]
之后
predicate = criteriaBuilder.lessThan(i.get(column), param.getValue().toString());
摆脱toString并使用Compariable帮助我解决了这个问题
predicate = criteriaBuilder.lessThan(i.get(column), param.getValue().toString());
predicate = criteriaBuilder.lessThan(i.get(column), (Comparable) param.getValue());