schlingel
schlingel

Reputation: 1694

Why does this JPQL fail with message "You have attempted to set a parameter at position 1 which does not exist in this query string"?

I have an interface extending JpaRepository containing this update query defined like that:

@Modifying
@Query("UPDATE configuration SET id = replace(id, ?1, ?2) WHERE id LIKE ?3")
void updateId(String replaceThis, String replaceWith, String like);

I get always "You have attempted to set a parameter at position 1 which does not exist in this query string UPDATE configuration SET id = replace(id, ?1, ?2) WHERE id LIKE ?3" error message which I don't understand because parameter at position 1 clearly exists where I put it. What am I missing?

Upvotes: 0

Views: 342

Answers (1)

JLazar0
JLazar0

Reputation: 1292

you can try this query:

   @Query("UPDATE configuration SET id = function('replace',id, ?1, ?2) WHERE id LIKE ?3")?

Upvotes: 2

Related Questions