user3875672
user3875672

Reputation: 87

selecting the first element value from the list returned by criteria

I have criteria which is finally returing a list as shown below..

ment = (Iils) criteria.uniqueResult();

but please advise how can I do the necessary changes as i want to retrieve the first item from the list and not the unique result please advise what changes i need to do to achieve that

Upvotes: 0

Views: 1374

Answers (1)

Ker p pag
Ker p pag

Reputation: 1588

You can use the setFirstResult() and setMaxResults() method in Criteria. Here is an example

criteria.setFirstResult(0);
criteria.setMaxResults(1);

Upvotes: 1

Related Questions