-->
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: Problem with getSingleResult() and setMaxResults(int)
PostPosted: Sat Nov 21, 2009 9:54 am 
Newbie

Joined: Sat Nov 21, 2009 9:42 am
Posts: 7
Hello,

I'm new to Hibernate, so I beg your pardon in the first place for asking questions that might seem simple or clear.

We're running Hibernate 3.4.0 in a standalone application, on a MySQL 5 database (driver: mysql-connector-java-5.1.6).
Whenever I use query.getSingleResult() or query.setMaxResults(1) and query.getResultList() Hibernate produces invalid SQL like
select
top ? loginsetti0_.setting_id as setting1_4_
from
login_setting loginsetti0_
inner join
setting loginsetti0_1_
on loginsetti0_.setting_id=loginsetti0_1_.setting_id
where
loginsetti0_1_.setting_spec_id=?
and loginsetti0_.login_user_id=?

The identifier "top" obviously is not known to MySQL, why does Hibernate generate this?

Kind Regards,
Abbzug


Top
 Profile  
 
 Post subject: Re: Problem with getSingleResult() and setMaxResults(int)
PostPosted: Mon Nov 23, 2009 5:13 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Did you set the right dialect in your conf?

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: Problem with getSingleResult() and setMaxResults(int)
PostPosted: Mon Nov 23, 2009 6:41 am 
Newbie

Joined: Sat Nov 21, 2009 9:42 am
Posts: 7
Thanks mmerder,
That was the problem.
-Abbzug


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.