-->
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.  [ 6 posts ] 
Author Message
 Post subject: query.SetFirstResult(0) does not work on MySQL?
PostPosted: Fri Aug 12, 2005 12:11 pm 
Newbie

Joined: Fri Aug 12, 2005 11:57 am
Posts: 4
I was trying to retrive the first 5 records from the database by using the following query:

Code:
IQuery query = session.CreateQuery("FROM User AS user ORDER BY user.Id");
query.SetFirstResult(0)
query.SetMaxResults(5);

users = query.List();


But the line "users = query.List();" threw an exception:


Code:
NHibernate.ADOException: Co
uld not execute query ---> MySql.Data.MySqlClient.MySqlException: #42000You have an error in your SQ
L syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'NULL' at line 1
...


And I traced the query sent to mysql database server, the sql read:

Code:
select user0_.id as id, user0_.Role as Role, user0_.Password as Password, user0_.Name as Name, user0_.Description as Descript4_ from users user0_ order by  user0_.id limit 5, NULL


Doesn't SetFirstResult support 0 as the position?

In this case, if I use SetFirstResult(1), the query.list() worked, but the returned list did not include the first record in the table.

Is this a bug in NHibernate? By the way, I am using nhibernate-0.9.0.0.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 8:57 pm 
Newbie

Joined: Fri Aug 12, 2005 11:57 am
Posts: 4
can someone be so kind as to give some suggestion on this?

Is there a workaround to this issue?

Has anyone met this kind of problem before?

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 4:17 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This is a bug, no workaround is possible currently.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 5:09 am 
Newbie

Joined: Fri Aug 12, 2005 11:57 am
Posts: 4
Do you mind to tell me in which release this bug will be fixed?
:)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 12:44 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
I plan to fix it in 0.9.1 which I'll try to release in a few days.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 12:43 am 
Newbie

Joined: Fri Aug 12, 2005 11:57 am
Posts: 4
Thanks.
This is really a great work.


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