Ordinal Parameter Not bound : 2 in @Query annotation
To add to Jens' answer: be aware of the spaces!
For example, this will throw the error:
"WHERE v IN ?2" +
"AND amu.id= ?1 "
And this will work fine:
"WHERE v IN ?2 " +
"AND amu.id= ?1 "
It's a minute difference that's easy to overlook.
The problem is that you have only one bind parameter declared in the query but have actually two parameters in the method.
This is because in "AND amu.id= '?1' "
what looks like a bind parameter is actually a string literal due to the enclosing quotes.
If you want that to be handled as a bind parameter remove the quotes: "AND amu.id= ?1 "