-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using MySQL with LIMIT clause
PostPosted: Mon Feb 13, 2006 2:05 pm 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
Hi.

Is it possible to use the LIMIT clause of MySQL with NHibernate?

I've tried to page some results, but the NH took a lot of time selecting all records and filtering them after this. I've used the following code:

Code:
criteria.SetFirstResult(startRowIndex);
criteria.SetMaxResults(maximumRows);


The SQL generated was:

Code:
SELECT ... FROM myTable WHERE 1=1


Is it possible to generate

Code:
SELECT ... FROM myTable WHERE 1=1 LIMIT x,y


?

Tks ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 5:13 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
There should be a LIMIT clause in the generated SQL. If you are really sure there isn't, then please try to reproduce the behavior using a simple example and then submit a bug report to JIRA. But I think the problem is in your code.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 7:08 am 
Senior
Senior

Joined: Fri Jan 13, 2006 2:50 pm
Posts: 123
Location: Blumenau / SC / Brasil
sergey wrote:
There should be a LIMIT clause in the generated SQL. If you are really sure there isn't, then please try to reproduce the behavior using a simple example and then submit a bug report to JIRA. But I think the problem is in your code.


Hum, thanks Sergey. I was missing the property SelectCountMethod of the ObjectDataSource. It must be set to pass the StartRowIndexParameterName and MaximumRowsParameterName to my class.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.