-->
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.  [ 4 posts ] 
Author Message
 Post subject: hibernate3rc1 ignores where-clause in queries
PostPosted: Tue Mar 01, 2005 6:25 am 
Regular
Regular

Joined: Thu Feb 19, 2004 4:48 am
Posts: 62
The following statement worked fine under hibernate3b2:

from Quiz q order by q.sortOrder asc where parentunit_id=:chapterId

when upgrading to hibernate3rc1, the very same statement throws:

org.hibernate.QueryException: Named parameter does not appear in Query: chapterId [from de.vierundsechzig.springer.model.modules.quiz.Quiz q order by q.sortOrder asc where parentunit_id= :chapterId]

but the named parameter obviously appears in the query. It looks like the where-clause is ignored completely: Even if i put a static id in the where (from de.vierundsechzig.springer.model.modules.quiz.Quiz q order by q.sortOrder asc where parentunit_id= 103) the where-clause never appears in the generated sql.

Any ideas, what has changed between b2 and rc1 that could have caused this behavior?

thx in advance!
stf


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 9:56 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
What happens if you put the where clause first?
Code:
from Quiz q where parentunit_id=:chapterId order by q.sortOrder asc 

I'm nore sure if it is an agreed standard, but shouldn't your restriction come before your sorting?

Also:

Is parentunit_id a property of Quiz?:
Code:
from Quiz q where q.parentunit_id=:chapterId order by q.sortOrder asc 


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 9:58 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
A related post: http://forum.hibernate.org/viewtopic.php?t=939335


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 1:58 pm 
Regular
Regular

Joined: Thu Feb 19, 2004 4:48 am
Posts: 62
resolved this one: The parser cuts off silently, whatever comes after the order by - phrasing the statement correctly solves the case.


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