-->
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: hibernate issue with left join fetch
PostPosted: Mon Sep 22, 2014 7:30 pm 
Newbie

Joined: Mon Sep 22, 2014 7:28 pm
Posts: 1
I'm trying to get rid of left join fetch in one of our HQLs:

query = select r,f,c from ClassPos r, ClassFal f ,ClassCon c left join fetch c.ClassReg where

DB contains this data satisfying above where clause:

ClassPos has 1 row, ClassFal has 2 rows, ClassCon has 1 row and ClassReg has 1 row.

We're using scrollable results to scroll through the results:

ScrollableResults results = query.scroll(ScrollMode.SCROLL_INSENSITIVE);
i =0
while(results.next())
{
i++
}
print(i);
We're expecting the resultset to have 2 rows but it's returning 1(i=1). When we run the SQL, we can clearly see 2 rows in the DB.

Now when we get rid of left join fetch, we see the result set has 2 rows:

query = select r,f,c from ClassPos r, ClassFal f ,ClassCon c
where <clause>
Tried looking up various places but can't get a reason. Can somebody explain this behaviour?


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.