I had my query wrong... the following works perfectly:

select threads from ForumThread threads left join fetch
threads.LatestMessage as lastpost left join fetch lastpost.Author as
author left join fetch author.MainProfileImage as profileImage left
join fetch profileImage.MicroThumbnail where threads.Forum = :forum
order by threads.LastPostTime desc

On Oct 28, 11:56 pm, reach4thelasers <[email protected]>
wrote:
> Hey guys,
>
> I have a forum and I want to retrieve the first 10 Threads in the
> forum.  I also want to eager-load a many-to-one property LastMessage
> which contains the most recent message in that thread..... one step at
> a time, but then I want to join fetch the Author and then join fetch
> the author's thumbnail.  I hope to get a list of 10 threads, the most
> recent post, the author and the thumbnail in one query to the
> database.  But for some reason it doesn't work.
>
> from ForumThread threads where threads.Forum = :forum left join fetch
> threads.LatestMessage as lastpost
>
> Can anybody point me in the right direction?  I have had loads of
> success on a UniqueResult query, where I  display all the messages in
> a Thread and eager load all the messages, authors and thumbnails in
> this thread.  But for some reason it doesn't work with a List() query.
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to