I'm trying to dynamically set the lock timeout for a query with MyBatis and PostgreSQL.
My Mapper looks like :
@Select("SET LOCAL lock_timeout = '#{lockTimeout}s';"
+ "SELECT ......where id= #{myId} FOR UPDATE")
MyObject select(@Param("lockTimeout") String lockTimeout, @Param("myId") String id);
It seems that there is a mismatch with parameters and I'm getting a
org.postgresql.util.PSQLException: Index of column out of range : 2, number of column 1.
@SelectProvider won't match in my case because my parameter lock timeout isn't static.
Does anyone have an idea how can I dynamically set the parameter lock timeout?