Link to home
Start Free TrialLog in
Avatar of Ankita Chaudhari
Ankita Chaudhari

asked on

Hibernate, Java help

Can we use "fetch first 1 rows only" criteria within NamedQuery? I used it but it does not filter resultset. It returns all records. But, when I use the same query in NativeNamedQuery, it works. It does filter the resultset and returns only 1 record from DB2. Can anyone confirm if this is expected behavior?
Avatar of girionis
girionis
Flag of Greece image

I d not think it will work. You will have to use Criteria and call setMaxResults(int).
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.