You can make your attributes lazy loaded. The mapping looks something like
this
<class ...>
...
<set name="ClientInfoOne" cascade="all-delete-orphan" fetch="select"
lazy="true">
<key column="CLIENT_ID"/>
<one-to-many class="Model.ClientInfoOne, Model"/>
</set>
</class>
In this case the client infos are loaded when you need them. But you have to
care about the
session since the loaded associated objects are only valid within the same
session.
2009/6/13 bpeikes <[email protected]>
>
> I'm new to NHibernate, and before I use it, I need to understand a bit
> about lazy loading.
>
> I'm attempting to use it for a project, but I want to know how others
> would deal with an issue I ran into immediately.
> I have a Client class, which has information about, well, a client.
> Associated with a client is a whole hierarchy of collections of other
> classes which are in turn associated with another hierarchy of
> classes.
>
> On the main form of my application, I need to show a list of all
> clients. For that particular form, all I need is the clients nickname
> and ID. I do not need all of the other data that comes along with the
> client.
>
> Once I load a particular client though, I want some if not all of the
> data associated with them. How would you go about doing this? It seem
> silly to create a separate class called ClientNickName which has the
> associated Client and their nickname, with the Client being lazy
> loaded. Are there any other ways?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---