-->
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.  [ 1 post ] 
Author Message
 Post subject: HQL query on map key : Column not found: SQLGrammarException
PostPosted: Thu Dec 02, 2010 5:05 pm 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
Hi, I have the following model:
Code:
class A{
    Map<String, Integer> tags
}

class B{
   A a;
}


I need to find instances of B where its associated A has a certain key value in its tags map

I issue the following HQL Query
Code:
FROM B WHERE index(a.tags) = 'the_value'


Unfortunately, this yields to a SQLGrammarException.
The query being built has a WHERE clause that ends with:
Quote:
and tags2_.tags_idx='the_value'

and the exception message is Column not found: TAGS2_.TAGS_IDX

Unfortunately, the alias tags2_ is not previously declated in the statement, which leads to the exception.

Any ideas?

Regards

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.