-->
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.  [ 2 posts ] 
Author Message
 Post subject: limit no longer supported by HQL
PostPosted: Mon Feb 28, 2005 5:28 pm 
Newbie

Joined: Tue Nov 23, 2004 4:33 pm
Posts: 6
The limit clause is no longer recognized by the parser in Hibernate 3 rc1. It did work in Hibernate 3 beta 2 and Hibernate 2. Query.setMaxResults provides a workaround.

Error 2005-02-28 15:02:27.789 unexpected token: limit near line 1, column 49 [select t.id from hdc.Tracker t where t.id < 100 limit 10]
org.hibernate.hql.ast.QuerySyntaxError: unexpected token: limit near line 1, column 49 [select t.id from hdc.Tracker t where t.id < 100 limit 10]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:214)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionFactoryImpl.getReturnTypes(SessionFactoryImpl.java:583)
at org.hibernate.impl.AbstractQueryImpl.getReturnTypes(AbstractQueryImpl.java:453)
at org.hibernate.console.HQLQueryPage.getPathNames(HQLQueryPage.java:72)
at org.hibernate.eclipse.console.views.QueryPageViewer.addColumnsToTable(QueryPageViewer.java:189)
at org.hibernate.eclipse.console.views.QueryPageViewer.createTable(QueryPageViewer.java:164)
at org.hibernate.eclipse.console.views.QueryPageViewer.createControl(QueryPageViewer.java:147)
at org.hibernate.eclipse.console.views.QueryPageViewer.<init>(QueryPageViewer.java:105)
at org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(QueryPageTabView.java:78)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(QueryPageTabView.java:47)
at org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(QueryPageTabView.java:52)
at javax.swing.AbstractListModel.fireIntervalAdded(AbstractListModel.java:130)
at org.hibernate.console.QueryPageModel.add(QueryPageModel.java:50)
at org.hibernate.console.KnownConfigurations$3.queryPageCreated(KnownConfigurations.java:167)
at org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(ConsoleConfiguration.java:265)
at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:246)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.execute(ExecuteHQLAction.java:99)
at org.hibernate.eclipse.console.actions.ExecuteHQLAction.run(ExecuteHQLAction.java:94)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:1003)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:557)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:507)
at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:462)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1009)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2728)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2427)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1612)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1578)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:293)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:333)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:150)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268)
at org.eclipse.core.launcher.Main.basicRun(Main.java:260)
at org.eclipse.core.launcher.Main.run(Main.java:887)
at org.eclipse.core.launcher.Main.main(Main.java:871)
Caused by: line 1:49: unexpected token: limit
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:716)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:227)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:150)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:208)
... 44 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 5:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Limit was *never* a supported clause in HQL. You are meant to use setMaxResults().


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