Yick! You are probably right. PreparedStatement must retain the value of setMaxRows(). I had kinda assumed it only applied for the very next executeQuery() method, but probably not. Thats a VERY nasty bug. Would you submit a bug report please?
(Workaround is to disable Hibernate PreparedStatement caching.) Ken Robinson <[EMAIL PROTECTED]> To: "Hibernate developer list (E-mail)" Sent by: <[EMAIL PROTECTED]> [EMAIL PROTECTED] cc: eforge.net Subject: [Hibernate] Odd Query behavior 19/02/03 08:18 AM Hi all, We're noticing some strange behavior with Query.setFirstResult/Query.setMaxResults. If we execute a query with these values set, we get the expected result. However, if we then execute the same query (in a new session, with a new Query) without limiting the resultset, we still only get the limited resultset. Example: query1 = "select x from x in class XXXXX" query1.setFirstResult(0); query1.setMaxResults(20); query1.list() //returns the 20 results we expect then in a new session, we create a new Query object which just happens to have the same HQL. query2 = "select x from x in class XXXXX" query2.list() //still only returns 20 rows. Is there some sort of caching going on of the first/max values, or does the PreparedStatement cache think this is the same query, or is there something else going on here? Thanks, Ken ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel ********************************************************************** Any personal or sensitive information contained in this email and attachments must be handled in accordance with the Victorian Information Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988 (Commonwealth), as applicable. This email, including all attachments, is confidential. If you are not the intended recipient, you must not disclose, distribute, copy or use the information contained in this email or attachments. Any confidentiality or privilege is not waived or lost because this email has been sent to you in error. If you have received it in error, please let us know by reply email, delete it from your system and destroy any copies. ********************************************************************** ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel