Micronaut JDBC Repository - Exception trying to execute query

Viewed 177

I'm new to working with Micronaut Recently got a new job at a company who use it.

@JdbcRepository()
public interface UserDataRepository extends CrudRepository<UserRecord, UUID> {

    ...

    @Query(value = "SELECT * FROM Users u " +
            "INNER JOIN LabUsers lu ON u.Id = lu.UserID " +
            "WHERE :labID = lu.LabID")
    List<UserRecord> findByLabID(final String labID);

}

Every time I try to execute this method by running an integration test, I am getting the following exception:

io.micronaut.http.client.exceptions.HttpClientResponseException: Internal Server Error: Unable to set PreparedStatement value: The index 1 is out of range.

Really struggling to figure this out. Have described it to a colleague who is also out of ideas for things to try.

Elsewhere in this project, there is some pre-existing code which does something very similar. It works fine.

Thanks in advance.

1 Answers

Fixed the problem. The solution was to change the version of micronaut-data to 2.0.0. Previously, it was version 2.2.0.

I mentioned that this code working elsewhere in the project - this was a mistake, it was working elsewhere in a different project, and that project was using version 2.0.0.

Related