I’m having an issue getting my variable to work in my @Query. Below is the code
@Query("SELECT new User(userId, userEmail, userForename, userSurname, userMiddleName) " + "FROM User " + "ORDER BY :orderBy DESC") public List<User> findAllBy(@Param("orderBy") String orderBy);
I know the variable I want is being passed in properly. At the moment this is just returning all the results ordered by userId. If I hard code the value which is being passed into this function then it correctly returns the results ordered by userEmail (which is what is being passed in). Any suggestions would be great.