I have the following query in JPA, where I want to pass the EntityKey instead of multiple parameters to the method and use it in the where clause:
@Query(value = "UPDATE #{#entityName} SET counter=counter+1 " +
"WHERE id1=:key.id1 AND id2=:key.id2", nativeQuery = true)
@Modifying
fun incrementCounter(@Param("key") key: EntityKey)
Unfortunately the code above doesn't work and I get a Named parameter not bound : key.id1 exception.
Is it possible to pass and use a Dto in the query instead of multiple parameters?