Hmm posted too soon as always :-(


After studying the code some more I noticed that hibernate will use the setMaxRows() method on the PreparedStatement instead of adding a limit expression to the sql statement.
Hopefully this is just as good. I'll have to make sure it is.


Sorry for the inconvenience
Fredrik

From: "Fredrik Larsson" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [Hibernate] useLimit problems.
Date: Tue, 05 Aug 2003 16:09:49 +0200

Hello.

I'm having some troubles with useLimit() in net.sf.hibernate.loader.Loader (hibernate 2.0)

The method looks like this
<snip>
private boolean useLimit(RowSelection selection, SessionImplementor session) {
Dialect d = session.getFactory().getDialect();
return d.supportsLimit() &&
( selection!=null && selection.getMaxRows()!=null ) && //there is a max rows
( d.preferLimit() || getFirstRow(selection)!=0 );
}
</snip>


My problem is that I want use setFirstResult(0), setMaxResults(100) when I retrieve the first part of a LAAARGE result set. Because of the getFirstRow(selection)!=0 expression in the implementation above a limit clause will not be added to the SQL statement.

My workaround is setFirstResult(1) but then I will not be able to retrieve one row (the first one) from the database.

Question:
Am I missing something obvious here or is this a bug?

Kind Regards
Fredrik Larsson

_________________________________________________________________
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

_________________________________________________________________ Hitta rätt på nätet med MSN Sök http://search.msn.se/



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to