-->
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.  [ 2 posts ] 
Author Message
 Post subject: Select by scalar collection value
PostPosted: Wed Aug 30, 2006 4:22 pm 
Newbie

Joined: Wed Aug 30, 2006 11:30 am
Posts: 3
I have what seems to be a simple request, but I have found it very difficult to do.

I have a scalar collection of strings for an object that represent (choose all that apply) answers.

I want a query to find only the objects that contain a particular answer in their string collection.

I tried an HQL query "from Member m where ? in elements(skills)" this generates a subquery where its selects all the member fields and then tries "where ? in (select skill from memberSkills)"

What I really want is:
"where m.id in (select memberid from memberSkills where skill = ?)


Here is the mapping of the skills collection on Member:
<set
name="skills"
table="memberSkills"

<key
column="member_id"
>

</key>

<element
column="skill"
type="string"
not-null="true"
unique="false"
/>

</set>

For the life of me I cannot figure out how to query a member where skill = "Public Speaking"

Since it not an association I cannot do something like:

From Member where member.skills.name = ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 16, 2006 12:11 pm 
Newbie

Joined: Wed Apr 20, 2005 4:37 pm
Posts: 6
I was having the same problem as you, and I came across an earlier post that solved this problem. Take a look at the replies of the following post:

http://forum.hibernate.org/viewtopic.php?t=962151

Good luck


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