Suppose Object A contains a collection of Object B. Let’s say it’s a one to many (an object B belongs to only one object A)
Now suppose for some reason I already have all the different Object B’s in the session cache already.
Now if I went and fetched an object A from the database (giving me an object A with an uninitalized collection of Object B), is there a way I can tell nhibernate to go into the session cache and find all the object B’s that belong to this object A and initialize the collection of object B’s within the object A I just got?
By initializing the collection, I mean that when I try to use it, it does not need to send any more queries to the database.
I’m using Nhibernate 3.2.
Thanks!
Short answer: no. It doesn’t work that way.