Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "error": "<expression>,<operator>, GROUP, HAVING or ORDER expected got '('"

IntelliJ IDEA Ultimate is showing me an error:

<expression>,<operator>, GROUP, HAVING or ORDER expected got '('

right under a braket inside a HQL statement which apperently is not a problem for compilation or runtime.

@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);

Any idea why this is the case and how to get rid of this? It's annoying and missleading (presumably since the code is working).

enter image description here

like image 925
Stefan Falk Avatar asked May 27 '26 12:05

Stefan Falk


1 Answers

https://www.baeldung.com/spring-data-jpa-query -> In 2.2 Native

@Query(
  value = "SELECT * FROM USERS u WHERE u.status = 1", 
  nativeQuery = true)

is worked for us. You need to add "value = " and ", nativeQuery = true" inside the @Query

like image 53
Dilara Şeyma Şahbaz Avatar answered Jun 01 '26 17:06

Dilara Şeyma Şahbaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!