-->
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: strange error in named query
PostPosted: Wed Dec 02, 2009 10:30 pm 
Newbie

Joined: Wed Apr 08, 2009 1:11 pm
Posts: 19
Hi,

This query is fine:

[code]
from Annotation a
where a.bookId = :bookid and a.pageIndex = :pageindex and (a.type != 1 or a.destBookId is null)
[/code]

This query causes an exception when hibernate loads because it claims there is an error in this named query:

[code]
from Annotation a
where a.type == 1 and a.destBookId is null and a.bookId == ?
[/code]

Its making no sense at all!

Andy


Top
 Profile  
 
 Post subject: Re: strange error in named query
PostPosted: Thu Dec 03, 2009 9:27 am 
Regular
Regular

Joined: Mon Aug 07, 2006 5:07 am
Posts: 56
Is it possible to use Annotation (which is a Java interface) in a Hibernate query?
Won't Hibernate try to do a.getBookId(); on this interface http://www.uni-muenster.de/ZIV.BennoSueselbeck/java/jdk1.5.0_01/docs/api/java/lang/annotation/Annotation.html?

What is the Exception / Stacktrace you are getting?


Top
 Profile  
 
 Post subject: Re: strange error in named query
PostPosted: Thu Dec 03, 2009 9:29 am 
Regular
Regular

Joined: Mon Aug 07, 2006 5:07 am
Posts: 56
Disregard my post. I didn't understand the exact question correctly that the first query works.

I don't know for sure what might be wrong ... but in the aboven you use = :parametername to check parameters, and in the latter you use == ? for parameter solving.
Isn't there a problem overthere?

Still, what is the stacktrace?


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.