2009/3/20 dhtroy <dht...@gmail.com>

>
> I have implemented IPostLoadEventListener and in this listener, for a
> specific parent object, I want to populate some data fields in that
> object, as well as some of the data in that parent's child
> collections.
>
> I have two issues that I need to resolve:
>
> #1 - when I access the child object collections, NHibernate recurses
> out of that call and goes and loads the child. I would expect this to
> happen if Lazy loading was enabled, but it's not. Is this expected
> behavior?


Without lazy loading children are loaded immediately after load parent or
with parent is you are using fetch=join.
You can use "join fect" (higher loading) in a HQL/Criteria, even for
multiple collections, but only if the entity have at most one <bag> (to know
why think about the SQL).


>
> #2 - after the parent object loads, then all the children are loaded,
> but if I need to populate some of those child collections with data,
> for that specific parent object type, how do I determine that the
> object coming through the Load Event Listener belongs to the patient
> object I am trying to load data for (hoping there is a field I can key
> off of).


Probably you are delegating business matters to the DAL and probably because
of that you are having this kind of "problems".


>
> More specifically, we want to inject specific data into our DTO after
> it's read through NHibernate. I had thought doing this in a PostLoad
> event would have already hydrated the entire object, child collections
> and all, if lazy loading were disabled, but that doesn't appear to be
> the case.
>
> Advise more welcome.



-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to