-->
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: query on collections
PostPosted: Fri Jan 30, 2004 3:27 pm 
Newbie

Joined: Thu Dec 11, 2003 12:14 pm
Posts: 8
I have the followind tables:

A one-to-many B with lazy = false. A has a collection of Bs named bs.

If I execute a find in A, the B collection is OK. But I need something like that:

Code:
from eg.A as a
where a.b.surname = :surname
order by a.name, a.bs.name


Is that possible ? I looked at the documentation about this, with no success.

I'm using Hibernate 2.1.1 with Oracle 9.2

thanks a lot
Sergio

_________________
[]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 30, 2004 3:29 pm 
Newbie

Joined: Thu Dec 11, 2003 12:14 pm
Posts: 8
When execuing that, I got the following error:

Caused by: net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: surname [
from eg.A as a
where a.b.surname = :surname
order by a.name, a.bs.name
]

_________________
[]


Top
 Profile  
 
 Post subject: elements
PostPosted: Fri Jan 30, 2004 4:38 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 8:13 pm
Posts: 31
Location: Newport Beach, CA
Use something like this pseudocode:

select A a
from a, B b
where b in elements(a.b)
and b.surname = ?

Doco section 10.8


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.