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);