Fabio - My apologies, my terminology is messed up here ... we're hydrating an entity from 2 different DB.
On Mar 21, 1:22 pm, Fabio Maulo <[email protected]> wrote: > I don't understand.You are hydrating a DTO (not an entity) from 2 DB ? > > 2009/3/21 dhtroy <[email protected]> > > > > > > > Fabio, > > > Your first answer makes sense, I was expecting that, but thought I > > should ask to make certain I understood what was happening. > > > As for your second answer, I'm not sure I was clear on what we're > > attempting to do, so let me try to explain it again: > > > We have a new SQL database that NHibernate is directly connected to > > and we have a legacy database that we cannot connect up to NHibernate, > > but one we must retrieve a pre-defined amount of data from. We had > > hoped to be able to achieve this goal by using the new Event system in > > NHib 2.0. As data is loaded into the DTOs, we would grab what we need > > from the legacy file system, putting that data into the DTO as they > > are hydrated from the newer SQL database. > > > Having said that, and knowing that this legacy system cannot be > > connected to NHibernate, and yet we need to pull data from both the > > newer SQL database and the old legacy database, and load all that into > > a single DTO, can you offer guidance on what direction I could pursue, > > if what we were trying to do isn't going to work? > > > Thank you. > > > On Mar 20, 5:27 pm, Fabio Maulo <[email protected]> wrote: > > > 2009/3/20 dhtroy <[email protected]> > > > > > 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 > > -- > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
