# Set limit returns empty result on custom entity

**URL:** <https://forum.shopware.com/t/set-limit-returns-empty-result-on-custom-entity/96761>\
**Category:** Programming (EN)\
**Created:** [20. Oktober 2022 um 05:00 UTC](https://forum.shopware.com/t/set-limit-returns-empty-result-on-custom-entity/96761 "2022-10-20T05:00:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binu](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Binu](https://forum.shopware.com/u/Binu)\
**Post date:** [20. Oktober 2022 um 05:00 UTC](https://forum.shopware.com/t/set-limit-returns-empty-result-on-custom-entity/96761/1 "2022-10-20T05:00:34Z")

</div>

Hi,

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.

```auto
        $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.
