-->
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: How to compare 2 Collections with like-operator ?
PostPosted: Fri Oct 05, 2012 10:18 am 
Newbie

Joined: Fri Oct 05, 2012 8:29 am
Posts: 1
Hi,

i need help for writing a hql-query, which compares two collections with the like '%tag%' operator.

Just imagine you have two collections with some tags (they arent fix):

CollectionA
- football
- volleyball
CollectionB
- football first class
- first class football

Now for every tag in Collection A i want to find the hits in Collection B.

The query
"select count(ca.tag) from CollectionA ca where ca.tag = any (select cb.tag from CollectionB)"

works fine for exactly same tags, but i need a query with like-operator ("%tag%) and the any function doesn't work with like.

Can you help me to create a correct hql-query for this job?


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.