Issue
I'm not sure why I'm receiving this error. I'm trying to get data from two separate tables in this query.
@Query("SELECT * FROM ConnectionRequest c " +
"INNER JOIN (SELECT firstName as name FROM USER u WHERE c.userId = u.id) " +
"WHERE c.dateTimeCompleted IS NULL", nativeQuery = true)
List<ConnectionRequest> findAllByDateTimeCompletedIsNull();
Solution
If you are providing only a single value for a parameter named value
, you can simply put the value itself inside the parentheses. However, if you are providing multiple arguments, even if one is for a parameter named value
you must specify value = "text"
.
By the way, you should try hard to avoid nativeQuery
as it bypasses both the checks and optimizations that JPQL can provide for you. In this case, you can probably let Spring Data write the entire query for you based on a method name (like findAllByUserFirstNameAndDateTimeCompletedIsNull()
).
Answered By - chrylis -cautiouslyoptimistic-
Answer Checked By - Marie Seifert (JavaFixing Admin)