Set limit returns empty result on custom entity


I have a custom entity created. It was working fine. I tried the following query on the table and it return 1000+ rows and which is correct.

        $criteria = new Criteria();
        $result = $this->repository->search($criteria, $context)->getElements();

But however, when I add $criteria->setLimit(10); to the query, it will return an empty array.
Any idea what I did wrong over there?

On dumping criteria it is showing the limit is added to the criteria.

The same query works on product repository with setLimit. So I doubt the issue is with the entity or table definition.

Thanks for the replies in advance.