I'm seeing the below error whenever I try and execute a nativeQuery with params.
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"
The query being used and repo function is below
private String queryStr = "SELECT * FROM schema1.txn " +
"WHERE stat = 'Shipped' " +
"AND id IN :idList\\:\\:text[] " +
"AND issue_dt < NOW() - :ageToExpire\\:\\:interval";
@Query(value = queryStr, nativeQuery = true)
List<txn> findTxns(
@Param("idList") String idList,
@Param("ageToExpire") String ageToExpire
);
And the findTxns call looks like so
.findTxns("('ID1','ID2','ID3')", "'10 days'")
I'm unsure as to why I'm still seeing the above error. I'm casting the string params to their respective text list and interval types but Postgres doesn't seem to agree with that. I've seen similar issues but I can't seem to get any of the marked resolutions working in my case; I've tried isolating the query to just use one param but that isn't resolving anything.