-->
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.  [ 4 posts ] 
Author Message
 Post subject: Referring to the index of an item in a list in a query
PostPosted: Wed Sep 24, 2008 8:09 pm 
Newbie

Joined: Wed Sep 24, 2008 7:56 pm
Posts: 2
I have a list of value types associated to an entity type. I want to write a query to that returns the item in the list at a specific index. Something like:

Code:
select value
from Entity as entity
       join entity.valuelist as value
where entity.id = :id
      and value.index = 5


of course the value.index does not work, but is there someway to do the equivalent?


-Jaimark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 11:28 am 
Regular
Regular

Joined: Mon Apr 19, 2004 6:54 pm
Posts: 79
Have you tried the index() function:

Code:
select value
from Entity as entity
       join entity.valuelist as value
where entity.id = :id
      and index(value) = 5


Christophe


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 5:20 pm 
Newbie

Joined: Wed Sep 24, 2008 7:56 pm
Posts: 2
Sweet!

That was just want I wanted. Plus the elements function.

Thanks,

-Jaimark


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 5:09 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
jaimark wrote:
Sweet!
That was just want I wanted. Plus the elements function.
-Jaimark


so, why don't you rate him?


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