You can provide limitations by limitstatement in your SQL. And have nativeQuery = true in @Query annotation to set JPA provider(like Hibernate) to consider this as a native SQL query.
@Query(nativeQuery = true, value = "SELECT * FROM SLSNotification s WHERE s.userId = :userId ORDER BY snumber DESC LIMIT 20")
List<SLSNotification> getUserIdforManage(@Param("userId") String userId);
Or
Additionally if you want to exploit the handy features from Spring Data JPA,
you can do it by proper method naming
List<SLSNotification> findByUserIdOrderBySNumber(@Param("userId") String userId, Pageable pageable);
If you dont know already, Spring Data JPA constructs Query from the method names. Amazing, right? Read this documentation for better understanding.
Now just call this method like
Pageable topTwenty = PageRequest.of(0, 20);
List<SLSNotification> notifications = repository.findByUserIdOrderBySNumber("101", topTwenty);
Besides, If you are using Java 8
You have option for having default method in interface and make life a bit easier
List<SLSNotification> findByUserIdOrderBySNumber(@Param("userId") String userId, Pageable pageable);
default List<User> findTop20ByUserIdOrderBySNumber(String userId) {
return findByUserIdOrderBySNumber(userId, PageRequest.of(0,20));
}