IntelliJ IDEA Ultimate 向我显示错误:
<expression>,<operator>, GROUP, HAVING or ORDER expected got '('
就在 HQL 语句内的小括号下,这显然对于编译或运行时来说不是问题。
@Query("SELECT offer FROM OfferEntity offer " +
" JOIN offer.placeOwnership AS owner " +
" JOIN owner.place AS place " +
"WHERE " +
" place.id = :placeId AND " +
" to_char(offer.dayFrom, 'yyyy-MM-dd') = :offerDate AND " +
^
<expression>,<operator>, GROUP, HAVING or ORDER expected got '('
" offer.repeating = false")
List<OfferEntity> getAllForDate(@Param("placeId") Long placeId, @Param("offerDate") String offerDate);
知道为什么会出现这种情况以及如何摆脱这种情况吗?这很烦人且具有误导性(大概是因为代码正在运行)。
最佳答案
https://www.baeldung.com/spring-data-jpa-query -> 在 2.2 原生中
@Query(
value = "SELECT * FROM USERS u WHERE u.status = 1",
nativeQuery = true)
对我们有用。您需要添加“值=”和“, @Query 中的nativeQuery = true”
关于java - 获取 "error": "<expression>,<operator>, GROUP, HAVING or ORDER expected got ' ('",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52708229/