-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Criteria setFirstResult throwing weird error
PostPosted: Fri Mar 09, 2012 3:14 am 
Newbie

Joined: Fri Mar 09, 2012 3:00 am
Posts: 1
Hi All,

We are using hibernate criteria. Its executing fine. But when I set fristResult and maxresult its throwing the below exception

StaleConnectionException: Attempt to use New Function Before New Function Mode.

The below is the code:

Criteria criteria = sessionFactory.openSession().createCriteria(DtoEqtymapNewSalPlanGrades.class);
criteria.add(Restrictions.isNull(QueryConstants.ID_PPR));
criteria.addOrder(Order.asc(QueryConstants.ID_COUNTRY_CODE).ignoreCase());
criteria.setFirstResult(1);
criteria.setMaxResults(12);
criteria.list();

Error is throwing when we invoke criteria.list(). Its working fine, if we comment the setfirstresult and setmaxresults methods. This is in DB2 .

Because of this exception we are not able to proceed with our pagination approach. Please let me know the root cause for this.


Top
 Profile  
 
 Post subject: Re: Criteria setFirstResult throwing weird error
PostPosted: Mon Mar 12, 2012 3:36 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
First thing you must check is, whether your database and jdbc-driver are supporting pagination approach.
This usually involves database cursorqueries, so I suggest you to read documentation about that.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.