我必须从mysql DB获取基于last_update_At的记录列表。在mysql中是一个timestamp字段。从我的java代码中,我以下面的格式传递日期。
Mon May 06 20:05:32 IST 2019在mysql中,last_update_At的格式为2019-05-06 19:46:00。我只想获取这个记录的日期比较,而不是与时间的比较。
请在下面找到我的hibernate查询:
@Query("select u from User u where u.lastLoginAt <= :thresholdDate")
public List<User> findLastLoginDaysDifference(@Param("thresholdDate") Date thresholdDate);使用此查询无法获取记录。
发布于 2019-06-26 22:05:03
您可以使用Hibernate强制转换操作符:
select u from User u where cast(u.lastLoginAt as date) <= :thresholdDatehttps://stackoverflow.com/questions/56756644
复制相似问题