-->
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: Multi query problem
PostPosted: Tue Feb 16, 2010 5:57 am 
Newbie

Joined: Tue Apr 15, 2008 7:56 am
Posts: 6
Hi,

I have a multi query problem, where i load several children, but somehow the order changes things.

These are the list of children i try to prefetch:
ptb.AfviklingsProfil.AfviklingsElementer
ptb.Renteprofil.RenteElementer
ptb.Vilkår.Indfrielsesvilkår.Indfrielsesvilkårelementer

This is the query:
Code:
string hqlPtb =
          "from Pantebrev ptb join fetch ptb.RenteProfil renteprofil join fetch renteprofil.RenteElementer join fetch ptb.FremtidigAmortiseringsplan where ptb.Oid = " +
          oid;

        string hqlPtbVilkår =
         "from Pantebrev ptb join fetch ptb.Vilkår.Indfrielsesvilkår join fetch ptb.Vilkår.Indfrielsesvilkår.Indfrielsesvilkårelementer where ptb.Oid = " + oid;

        string hqlPtbAmortplan =
         "from Pantebrev ptb join fetch ptb.AfviklingsProfil join fetch ptb.AfviklingsProfil.AfviklingsElementer where ptb.Oid = " + oid;

        var result = Context.Current.Session.CreateMultiQuery().
          Add(hqlPtb).
          Add(hqlPtbVilkår).
          Add(hqlPtbAmortplan).
          List();

        IPantebrev ptb = (IPantebrev)((ArrayList)result[0])[0];


The elements ptb.AfviklingsProfil.AfviklingsElementer only fetches 1, even though i can see the resulting sql gets 2 from the database.

So somehow NHibernate doesn't get ptb.AfviklingsProfil.AfviklingsElementer inserted correct into the object tree.

If i only execute
Code:
var result = Context.Current.Session.CreateMultiQuery().
          Add(hqlPtbAmortplan).
          List();

It fetches 2 ptb.AfviklingsProfil.AfviklingsElementer

Why is this? Anyone knows? Why does it only get 1 ptb.AfviklingsProfil.AfviklingsElementer if i do the large composed multiquery?

Regards,
CSky


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.