-->
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: Grails HQL Query Is Not Working ---- Please Help
PostPosted: Thu Dec 26, 2013 10:17 am 
Newbie

Joined: Thu Dec 26, 2013 9:50 am
Posts: 1
-------------------DOMAIN CLASSES--------------------
class Venture{
static hasMany = [executives:Role,advisors:Role, team:Role]}

class Role{
Person owner
}
--------------------Goal Trying to Obtain-----------------------
Return all Venture instances where the Person "userId" has a designated Role

---------------------The Query--------------------------
select venture from Venture venture
inner join venture.executives as ex
inner join venture.advisors as av
inner join venture.team as tm
where :userId in elements(ex.owner) or :personInstance in elements(av.owner) or :personInstance in elements(tm.owner)

-----------------------HQL Exception I get-------------------------
Message: unexpected token: exists near line 6, column 23 [
select venture from TEC.Venture venture
inner join venture.executives as ex
inner join venture.advisors as av
inner join venture.team as tm
where :userId exists elements(ex.owner) or :userId exists elements(av.owner) or :userId exists elements(tm.owner)
]

------------------------Solution so far-----------------------
I solved this problem by performing separate queries than joining the results.....However, if there's any feedback you can offer regarding how to join multiple associations and filter based upon the ids of a child attribute within the association it will be greatly helpful!


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.