-->
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: Help with a HQL search of collection item field
PostPosted: Wed Nov 24, 2004 11:50 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
Hi,

I have a parent object POF with a collection lineItems. I am attempting to issue a 1 query search that returns all POF objects where a line item's description has a likeness to a string.

The following fails with The column prefix 'li' does not match with a table name or alias name used in the query. I know why but my HQL is not good enough to express what I wish to do.

from POF as p left outer join fetch p.lineItems as li where lower(li.description) like '%abc%'

Your help appreciated!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 24, 2004 2:23 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Code:
from POF as p left, Line  as l
where lower(l.description) like '%abc%'
and l in elements (p.lineItems)

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 5:13 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
thanks :) i also found this to work

select p from package.to.POF p join p.lineItems li where lower(li.function) like '%c%'


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 25, 2004 7:17 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
hi anthony,

your own suggestion failed with

outer or full join must be followed by path expression [from com.qas.newmedia.intranet.pof.dto.POF as p left join LineItem as li where lower(li.description) like '%hib%' and li in elements(p.lineItems)]

I assume because it does not seem to be able to dereference LineItem into it's full class package path?


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.