-->
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: How to query for collection of elements?
PostPosted: Mon Sep 22, 2008 10:07 am 
Beginner
Beginner

Joined: Fri Jun 29, 2007 11:12 am
Posts: 25
Hello,
i get:
org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree

whe i try to execute the following

Code:
from Person p
where p.emails is not empty


emails is a collection of value types mapped as a @JoinTable. Is there a way to query for collection of elements?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 10:45 am 
Newbie

Joined: Fri Jul 11, 2008 10:45 am
Posts: 5
try

[code]from Person p
where size(p.emails) > 0[/code]

or

[code]from Person p
where p.emails.size > 0[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 11:25 am 
Beginner
Beginner

Joined: Fri Jun 29, 2007 11:12 am
Posts: 25
Thank you,
both work. So one can't really query for value types.


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.