-->
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: LIKE Expression for collection elements in HQL?
PostPosted: Mon Mar 05, 2007 8:28 am 
Beginner
Beginner

Joined: Thu Apr 07, 2005 5:12 pm
Posts: 27
Location: Hamburg
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

3.1.2:

Postgres 8.1:


Hi,

I have an hql query like this:

Code:
... AND LOWER(:licenseNumber) in (select lower(lnumber.licencenumber) from LicenceNumber lnumber where lnumber in elements(vehicle.licenceNumbers)) ....


My Problem is, that I don't want that the :licenceNumber has to match exactly, so need something like "the LIKE expression for properties" to match the :licenceNumber against the items in the subquery result).

Is this possible?

Thank you.


Top
 Profile  
 
 Post subject: Re: LIKE Expression for collection elements in HQL?
PostPosted: Thu Aug 27, 2015 12:15 am 
Newbie

Joined: Thu Aug 27, 2015 12:06 am
Posts: 1
I know this is a couple of years late... but it might help others that won't need to endure the ghastly amount of time that I have spent trying to answer this problem.

What you are looking to do can be done with a join clause.

say you have an object Foo with a collection of Bar objects:

class Foo(){

...

Foo(){}

List<Bar> bars;

}

To query the bars collection with a LIKE operator:

select f from Foo f join f.bars b where lower(b) like lower(:searchCriteria)


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.