1

This is crazy I try lots of way but this is still showed up. It said that:

Parameter with that name [sortBy] did not exist. Look, it is already there. When I try to edit the Query with AND instead of case when, it worked but not the query I want.

My repository:

 @Query("SELECT u FROM CommentEntity u WHERE u.postId = :postId " +
        "order by case when (u.sentimentScore = :sortBy) " +
        "then -1 else u.sentimentScore end" )
Page<CommentEntity> findAllByPostIdwSort(@Param("postId")String postid, 
                                         @Param("sortBy")Integer sortBy, 
                                         Pageable pageable);
Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
  • What's the JPA implementation in your project? I can reproduce this issue using Hibernate JPA. http://stackoverflow.com/q/4120388 mentions `input parameters are only allowed in the WHERE and HAVING clauses`. – Beck Yang Nov 25 '16 at 23:53
  • Was this issue resolved, I'm facing same problem – Shashank Feb 16 '17 at 06:45

0 Answers0