-->
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.  [ 1 post ] 
Author Message
 Post subject: Multiple Left Joins in same HQL Query... Strange results...
PostPosted: Tue Aug 03, 2004 3:03 pm 
Newbie

Joined: Tue Aug 03, 2004 2:54 pm
Posts: 9
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.