Unable to pass positional parameters into HQL query

Richard Payne :

Whilst trying to create an API for my app I tried to make a query that takes a value passed in and then returns the response from the db.

@Query(value = "SELECT u FROM User u WHERE u.userID = ?")
User getUserById(String id);

I have created queries this way in other projects but cannot figure out why I get the following error on this project

JDBC style parameters (?) are not supported for JPA queries.
Elarbi Mohamed Aymen :

have you tried this :

@Query(value = "SELECT u FROM User u WHERE u.userID  = :id")
User getUserById(String id);

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=467055&siteId=1