-->
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.  [ 5 posts ] 
Author Message
 Post subject: Fetch joins, proxies and StatelessSession
PostPosted: Thu Jan 10, 2008 12:19 pm 
Newbie

Joined: Thu Jan 10, 2008 11:01 am
Posts: 2
Hi!

My case is as follows: We're using stateless Hibernate session to query large number of objects of type A together with their related objects (1-1 relations, but that's not essential). So my HQL looks more-less like this:

SELECT t1, t2, t3 FROM Type_A t1 LEFT JOIN FETCH t1.relation1 t2 LEFT JOIN FETCH t1.relation2 t3

The SQL generated looks OK, three tables were joined, all columns from those tables fetched. But when it comes to what objects Hibernate returns (through ScrollableResults if that matters) we have a problem. The main object is fine, but getRelation1() or getRelation2() return proxies instead of initialized target instances. Why? Of course stateless session is unable to initialize those proxies so we get an exception when try to access any of their properties.

Yes, we have lazy loading enabled in the mappings (cause most of the time we're using stateful sessions and don't want to eager fetch anything). But weren't JOIN FETCHes supposed to get all the data at once? If we already have all the data needed to create both main object and it's relations what's the point in creating proxies? What's worse uninitialized proxies - thus useless as stateless session can't do anything to initialize them.

And yes, I really want to use stateless session as I want to query really huge amounts of data and I want it quick (bypassing Hibernate'e events, caches, etc.).

Any ideas how to get rid of those proxies in that particular case?
Thx in advance,
Pawel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 22, 2008 10:25 am 
Newbie

Joined: Thu Jan 10, 2008 11:01 am
Posts: 2
Hi again,

Does REALLY no-one has any idea what could I do with it? The problem persists :(

Thanks in advance :)
P.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 13, 2008 5:13 pm 
Beginner
Beginner

Joined: Mon Aug 22, 2005 1:22 am
Posts: 36
Did you find out how to by pass this issue? I am having the same problem and not sure why.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2008 7:20 am 
Newbie

Joined: Mon May 26, 2008 6:36 am
Posts: 5
So someone found the problem ? I'm experiencing that too in a big select request, sometimes it returns me a proxy without possibilities to catch the object, whereas i had many request who worked correctly on same relation object ...

It looks like a CGLIb problem, or it's the scroll who desn't work correctly with Join conditions ?


Top
 Profile  
 
 Post subject: See issue HHH-3528
PostPosted: Mon Oct 13, 2008 9:16 pm 
Newbie

Joined: Fri Jul 14, 2006 12:05 pm
Posts: 19
The problem seems to be due to a bug in StatelessSessionImpl. I attached a patch to fix it to issue HHH-3528 in JIRA (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3528). I don't guarantee that it doesn't break anything else, but it works for me.


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

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.