'Compare long/miliseconds in JPA
One of the field is getting converted to epoch miliseconds and getting stored in the database.
Now in one of the request we are getting date range, and when we convert to miliseconds and compare we are getting more than what we expect and below is the query
private Long lastUpdatedOn;
@Query(value = "select u from User u where u.lastUpdatedOn >= :fromDateInMillis and u.lastUpdatedOn < :toDateInMillis")
and I tried to convert it to Date and compare and below is the query
@Query(value = "select u from User u where date/Date(u.lastUpdatedOn) between :fromDate and :toDate")
i'm getting below error
java.lang.IllegalArgumentException: org.hibernate.QueryException: could not Extract Resultset, there is no date(long) constructor
i'm stuck at this stage
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
