-->
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.  [ 4 posts ] 
Author Message
 Post subject: Multiple collections limitation overrides max_fetch_depth?
PostPosted: Tue Oct 18, 2005 3:15 pm 
Newbie

Joined: Tue Oct 11, 2005 3:18 pm
Posts: 16
I know that only one collection per query is allowed, but that is to avoid cartesian product. However, mapping a collection within a collection is not a cartesian product, and the outer joins should be limited only by max_fetch_depth. In my example, Trade has a lazy=false collection of TradeLegs, and each TradeLeg has a lazy=false collection of Quantities... this should be no problem for my max_fetch_depth 5... and yet I get the following error...

Message : cannot fetch multiple collections in one query [ from BP.IST.Domain.Trade.Trade t left join fetch t.TradeLegs l left join fetch l.Quantities q where ((((t.InternalCounterParty.Id = 1950) AND ((l.EffectiveDates.From <= '31-Jul-2005') AND ((l.EffectiveDates.To >= '1-Jul-2005') AND ((q.EffectiveDates.From <= '31-Jul-2005') AND (q.EffectiveDates.To >= '1-Jul-2005'))))) AND (l.PipelineId = 1903)) AND (l.TradeZoneId = 289))]

Am I missing something? Or is the multiple collections limitation overriding the max_fetch_depth?
Thanks.

BTW... this worked great previously with .9.... busted with 1.0


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 3:23 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
That check is there because only one of the collection roles would in fact be initialized in your case. All objects for the other one would be loaded, but the collection instance itself would remain uninitialized.

You can of course try disabling the check (and recompiling) and if both collections are in fact initialized, then I will make the check less restrictive in a future version. But I doubt this will work.

By the way, max_fetch_depth is only in effect when loading a single object (as far as I can tell).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 4:01 pm 
Newbie

Joined: Tue Oct 11, 2005 3:18 pm
Posts: 16
I commented out the check, and it works great just like in .9..... thanks!

public void SetCollectionToFetch( string role, string name, string ownerName, string entityName ) {
//10-18-05 dmcmullan - commented to allow full fetch depth
// if( fetchName != null )
// {
// throw new QueryException( "cannot fetch multiple collections in one query" );
// }


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 5:05 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
And does the middle collection (t.TradeLegs) actually get initialized? Try checking it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.