-->
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: Pagination problem with DB2Dialect(2.1.8)SQLErr: -104, 42601
PostPosted: Sun Apr 10, 2005 4:49 am 
Newbie

Joined: Sun Apr 10, 2005 4:36 am
Posts: 3
i think ther second order by in hibernate sql is no need.
but why hibernate can gernate it?

Hibernate version:2.1.8

Mapping documents:

Code between sessionFactory.openSession() and session.close():
StringBuffer hqlSB = new StringBuffer("from SysRole sr where 1 = 1 ");
hqlSB.append(" order by sr.roleid ");
Full stack trace of any exception that occurs:
WARN : 2005-04-10 00:10:48,022: JDBCExceptionReporter[line:57}:
ERROR: 2005-04-10 00:10:48,022: JDBCExceptionReporter[line:58}: [ISQL Error: -104, SQLState: 42601BM][CLI Driver][DB2/NT] SQL0104N An unexpected token "order" was found following "srole0_ where (1=1 )". Expected tokens may include: "GROUP". SQLSTATE=42601

WARN : 2005-04-10 00:10:48,032: JDBCExceptionReporter[line:57}: SQL Error: -104, SQLState: 42601
ERROR: 2005-04-10 00:10:48,032: JDBCExceptionReporter[line:58}: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "order" was found following "srole0_ where (1=1 )". Expected tokens may include: "GROUP". SQLSTATE=42601

opmanager:net.sf.hibernate.exception.SQLGrammarException: Could not execute query

Name and version of the database you are using:db2 7.2

The generated SQL (show_sql=true):
select * from ( select rownumber() over(order by sysrole0_.ROLEID) as rownumber_, sysrole0_.ROLEID as ROLEID, sysrole0_.ROLEDESC as ROLEDESC, sysrole0_.PARENT as PARENT from SYSROLE sysrole0_ where (1=1 ) order by sysrole0_.ROLEID ) as temp_ where rownumber_ <= ?

Debug level Hibernate log excerpt:

查询出错!: : [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "order" was found following "srole0_ where (1=1 )". Expected tokens may include: "GROUP". SQLSTATE=42601
wraps: [COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "order" was found following "srole0_ where (1=1 )". Expected tokens may include: "GROUP". SQLSTATE=42601
]


Top
 Profile  
 
 Post subject: can anyone help me?
PostPosted: Mon Apr 11, 2005 3:15 am 
Newbie

Joined: Sun Apr 10, 2005 4:36 am
Posts: 3
can anyone help me?


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.