Hi,
I am trying to do multiple left joins in a single query with paging. I am getting everything back with 2 selects to the database just as I expected and the speed is great. The problem is that when i try to use the paging (setMaxResult and setFirstResult) i always get all of the results.
When I had it with just one left join fetch, it worked with the paging as expected.... 10 at a time.
The weird thing is that if I grab the SQL generated by the hibernate debugging, paste it right into Oracle sqlplus, it returns the 10 records rather than all 30 of them.
Code:
String query = "from Forum f left join fetch f.topics t left join fetch t.voteDescription where f.forumId = :forumId order by t.topicType desc, t.lastPostTime desc";
Query queryObject = getHibernateTemplate().createQuery(session, query);
queryObject.setMaxResults(pageSize);
queryObject.setFirstResult(firstResult);
queryObject.setLong("forumId", forum.getForumId());
return queryObject.uniqueResult();
Does anyone have any insite into what I doing wrong? I am using Spring to managed my Session objects via OpenViewInSession... hibernate 2.1.3, and Oracle 9i.
Thanks!!!!
Nate