我有这个数据模型春数据查询日期时间只有日期
public class CustomerModel{
@Column
@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
private DateTime membershipDate;
//Other properties and getters
}
而下面的回购
public interface CustomerRepo extends Repository<CustomerModel, Long>{}
我想要做的是。检索给定日期的所有用户,例如(2013年8月1日加入的成员),但问题是在我的DB上,membershipDate有一段时间。我怎么能忽略时间和检索给定日期的所有用户?
在spring-data的v1.6.2中,此注释仅支持java.util.Date类型的参数。因此,此解决方案目前不适用于比较DateTime对象。当前的javadocs位于[here](http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/Temporal.html)。 – yurodivuie
@yurodivuie - 这是一个伟大的捕获。感谢指针。我更新了答案,为JodaTime提供了一个替代解决方案,并概述了为什么它目前仅适用于Java Date类型。 –
实体中的Java 8 ZonedDateTime和作为搜索参数的LocalDate如何? –