Hi,
I was creating a repository method a la:
// PostgreSQL specific (due to "FOR UPDATE SKIP LOCKED")
@Modifying // <-- problematic line
@Query("DELETE FROM unmapped_event_queue WHERE event_id = ("
+ " SELECT event_id FROM unmapped_event_queue FOR UPDATE SKIP LOCKED LIMIT 1"
+ ") RETURNING event_id")
Mono<UUID> pollUnmappedEventID();
This fails with a "class cast exception" stating that an Integer cannot be converted to a UUID. I originally added the @Modifying because it says in its javadoc that it "Indicates a query method should be considering a modifying query as it that changes the way it needs to be excuted". I thought that matched my case but in reality it works if I omit @Modifying in this case.
I am guessing that @Modifying should have its documentation updated to state that you should use it only for modifying queries that do not rely on RETURNING.