On Wed, Feb 3, 2010 at 2:12 PM, KARR, DAVID (ATTCINW) <[email protected]>wrote:

> So I changed my query to:
>
> select foo from packagepath.Foo foo left join fetch foo.childBars as bar
>   where foo.id=:id and current_date between bar.startDate and
> bar.endDate
>
> try this:

select distinct foo from packagepath.Foo foo
left join foo.childBars as bar
left join fetch foo.childBars
where foo.id=:id
and current_date between bar.startDate and bar.endDate

Notice "distinct". You might find it works without out it bug a bug will
bite you later...

I'm not sure if you are expecting to get a subset of foo.childBars. If you
are, this won't work.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to