Sorry for the lack of detail. I figured out the problem. I'll detail it here to see if this makes sence.
Assume I have the exact same mapping files above with the addition of proxy="Topic" for the topic class. If I use the code below then it will create one query for the initial query, and another query to get the Topic for each call to isTopicClosed().
Code:
Query q = s.createQuery("from ForumTopic ft left join ft.topic t");
List<ForumTopic> l = q.list();
for (ForumTopic ft : l) {
boolean b = ft.getTopic().isTopicClosed();
}
However, if I add a select clause and explicityly call out getting the topic object then it works fine. It just requires a little extra work getting the objects out that you want, since it wraps them in an object array;
Code:
Query q = s.createQuery("Select ft, t from ForumTopic ft left join ft.topic t");
q.setFirstResult(0);
q.setMaxResults(5);
List<Object[]> l = q.list();
for (Object[] o : l) {
ForumTopic ft = (ForumTopic) o[0];
boolean b = ft.getTopic().isTopicClosed();
}
btw: the new Generics in Java 1.5 seem to work find with Hibernate which makes me very happy. ;-) Thanks again!