我有一个应该获取报价的存储库:
UIGestureRecognizer.State.ended
但是,这在我得到的时候不起作用:
@Query("SELECT offer FROM OfferEntity offer " +
" JOIN offer.placeOwnership AS owner " +
" JOIN owner.place AS place " +
"WHERE " +
" place.id = :placeId AND " +
" to_char(offer.offerDate, 'yyyy-MM-dd') = to_char(:date, 'yyyy-MM-dd') ")
List<OfferEntity> getAllForDate(@Param("placeId") Long placeId, @Param("date") ZonedDateTime date);
我不知道问题出在哪里,但这显然是这部分:
Caused by: org.postgresql.util.PSQLException: ERROR: function to_char(unknown, unknown) is not unique
Hint: Could not choose the best candidate function. You might need to add explicit type casts.
Position: 649
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428) ~[postgresql-42.1.4.jar:42.1.4]
我该如何做?
如果我删除参数to_char(offer.offerDate, 'yyyy-MM-dd') = to_char(:date, 'yyyy-MM-dd')
:
date
它正在工作,但是-显然,这缺乏灵活性。
也:
to_char(offer.offerDate, 'yyyy-MM-dd') = '2018-10-07'
有效。
还有更多:
在'2018-10-07' = to_char(:date, 'yyyy-MM-dd')
中也不能这样工作:
java.util.Date