Hi Colin,
I don't suppose you ever resolved this one? We're hitting it in our NHB
code having migrated our project to single instance.
James
On Friday, 10 September 2010 11:42:21 UTC-4, Colin Bowern wrote:
>
> I've done some more digging and found that in case 2 the
> NHibernate.Loader.Loader.GetRow method has a copy of the object and
> follows this path which is why it doesn't report three objects being
> hydrated:
>
> //If the object is already loaded, return the loaded one
> obj = session.GetEntityUsingInterceptor(key);
> if (obj != null)
> {
> //its already loaded so dont need to hydrate it
> InstanceAlreadyLoaded(rs, i, persisters[i], key, obj,
> lockModes[i], session);
>
> It appears to not hydrate it because the object was retrieved as part
> of an earlier call which is correct. The question is why does it try
> to do another question to retrieve the object when it already has it?
> Digging back into the issues I see NH-1001 which somewhat describes
> the situation - JOIN on a many-to-one which returns the object, yet
> the loader goes out to try and retrieve it again. I'm bitten a second
> time by the fact that filters are not applied to that SELECT statement
> (if they were, then I wouldn't have an issue per
>
> http://groups.google.com/group/nhusers/browse_thread/thread/3852b75d3e984169).
>
>
>
> Am I too far into thet weeds here? How do I get the loader to not do
> that second SELECT statement and just use the object it already found?
>
> Thanks,
> Colin
>
> On Sep 9, 5:36 pm, Colin Bowern <[email protected]> wrote:
> > Is there any way to logging to turn up for troubleshooting why an
> > object wouldn't have been hydrated? Making the exact same call at two
> > different points is yielding different results in terms of object
> > hydration:
> >
> > Call 1 – Able to hydrate a bar object when opening an foo
> >
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [0]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 65535 -> [1]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [2]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 46 -> [3]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.StringType) Foo 2009 -> [4]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.StringType) 555123 -> [5]
> > NHibernate.Loader.Loader - SELECT this_.Id as Id12_2_, this_.ClientId
> > as ClientId12_2_, this_.ScheduleId as ScheduleId12_2_, this_.barId as
> > barId12_2_, schedule1_.Id as Id13_0_, schedule1_.ClientId as
> > ClientId13_0_, schedule1_.Name as Name13_0_, bar2_.Resource_Id as
> > Resource1_4_1_, bar2_.Client_Id as Client7_4_1_, bar2_.User_Id as
> > User8_4_1_, bar2_.bar_Id as bar9_4_1_, bar2_.bar_Name as bar10_4_1_,
> > FROM foos this_ inner join fooSchedules schedule1_ on
> > this_.ScheduleId=schedule1_.Id inner join VSec_User_bar_Info bar2_ on
> > this_.barId=bar2_.bar_Id and (bar2_.Client_Id = :p0 OR bar2_.Client_Id
> > IS NULL) and bar2_.User_Id = :p1 WHERE (schedule1_.ClientId = :p2 OR
> > schedule1_.ClientId IS NULL) and (this_.ClientId = :p3 OR
> > this_.ClientId IS NULL) AND schedule1_.Name = :p4 and bar2_.bar_Id
> > = :p5
> > NHibernate.Loader.Loader - processing result set
> > NHibernate.Loader.Loader - result set row: 0
> > NHibernate.Loader.Loader - result row:
> > EntityKey[Core.Domain.fooSchedule#2390744],
> > EntityKey[Core.Domain.bar#18641357],
> > EntityKey[Core.Domain.foo#3217256]
> > NHibernate.Loader.Loader - Initializing object from DataReader:
> > [Core.Domain.fooSchedule#2390744]
> > NHibernate.Loader.Loader - Initializing object from DataReader:
> > [Core.Domain.bar#18641357]
> > NHibernate.Loader.Loader - Initializing object from DataReader:
> > [Core.Domain.foo#3217256]
> > NHibernate.Loader.Loader - done processing result set (1 rows)
> > NHibernate.Loader.Loader - total objects hydrated: 3
> >
> > Call 2 – Not able to hydrate a bar object when copying a bar item
> > which opens an foo
> >
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [0]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 65535 -> [1]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [2]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.Int64Type) 5 -> [3]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.StringType) Foo 2010 -> [4]
> > NHibernate.Engine.QueryParameters -
> > BindParameters(Named:NHibernate.Type.StringType) 333222 -> [5]
> > NHibernate.Loader.Loader - SELECT this_.Id as Id12_2_, this_.ClientId
> > as ClientId12_2_, this_.ScheduleId as ScheduleId12_2_, this_.barId as
> > barId12_2_, schedule1_.Id as Id13_0_, schedule1_.ClientId as
> > ClientId13_0_, schedule1_.Name as Name13_0_, bar2_.Resource_Id as
> > Resource1_4_1_, bar2_.Client_Id as Client7_4_1_, bar2_.User_Id as
> > User8_4_1_, bar2_.bar_Id as bar9_4_1_, bar2_.bar_Name as bar10_4_1_,
> > FROM foos this_ inner join fooSchedules schedule1_ on
> > this_.ScheduleId=schedule1_.Id inner join VSec_User_bar_Info bar2_ on
> > this_.barId=bar2_.bar_Id and (bar2_.Client_Id = :p0 OR bar2_.Client_Id
> > IS NULL) and bar2_.User_Id = :p1 WHERE (schedule1_.ClientId = :p2 OR
> > schedule1_.ClientId IS NULL) and (this_.ClientId = :p3 OR
> > this_.ClientId IS NULL) AND schedule1_.Name = :p4 and bar2_.bar_Id
> > = :p5
> > NHibernate.Loader.Loader - processing result set
> > NHibernate.Loader.Loader - result set row: 0
> > NHibernate.Loader.Loader - result row:
> > EntityKey[Core.Domain.fooSchedule#2929992],
> > EntityKey[Core.Domain.bar#470090], EntityKey[Core.Domain.foo#3211664]
> > NHibernate.Loader.Loader - Initializing object from DataReader:
> > [Core.Domain.fooSchedule#2929992]
> > NHibernate.Loader.Loader - Initializing object from DataReader:
> > [Core.Domain.foo#3211664]
> > NHibernate.Loader.Loader - done processing result set (1 rows)
> > NHibernate.Loader.Loader - total objects hydrated: 2
> >
> > The first call correctly hydrates 3 objects, while the second call
> > hydrates only 2. Looking at the returned data I can't figure out why
> > the second call won't hydrate Bar.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.