Putting limits dynamically in @query spring data jpa

Solution 1:

The query must not end with ; , try to remove it

select * from post_table pt where post_id not in 
(select pt2.post_id from post_table pt2 order by pt2.likes desc, pt2.dislikes asc limit :start) 
order by pt.likes desc, pt.dislikes asc limit :end

Solution 2:

You should remove ; sign next to end; and it will work properly