-->
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: HibernateException: Errors in named queries
PostPosted: Mon Nov 13, 2006 6:34 pm 
Newbie

Joined: Fri Nov 10, 2006 6:37 pm
Posts: 9
[ i am using hibernate 3.2]

When my query looks like this

<query name="getCountGroupByName">
select count(group)
from ClusterGroupDO group
where group.name=?
</query>

I see hibernate error
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: group near line 2, column 22

But when I replace "group" above by "g", it works fine

<query name="getCountGroupByName">
select count(g)
from ClusterGroupDO g
where g.name=?
</query>

What is the explaination?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 7:51 pm 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Maybe group is a reserved word since it is also used in group by.

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 10:05 am 
Newbie

Joined: Fri Nov 10, 2006 6:37 pm
Posts: 9
> Maybe group is a reserved word since it is also used in group by.

I think you are right. However, another very similar query (except it does not count) works fine using "group".

<query name="getGroupsByName">
from ClusterGroupDO group
where group.name=?
</query>


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.