select u from User u join fetch u.RealPosition
2009/11/2 mitirino <[email protected]>
>
> Hi,
>
> I have many-to-one for User and Position and when I want to load the
> users it makes one select to get all the users and then one select per
> user to get the position for each one.
>
> Is there any way to avoid this and actually load everything with one
> select?
>
> Thank you
>
> ----
>
> IList<User> items = session.CreateQuery("from User").List<User>();
>
> ---
>
> <class name="User" table="User" >
> <id name="Id" column="id">
> <generator class="native" />
> </id>
> <property name="Name" column="name" />
> <property name="Year" column="year" />
> <many-to-one name="RealPosition"
> class="Position"
> column="position_id" />
> </class>
>
> ----
>
> <class name="Position" table="Position" >
> <id name="Id" column="id">
> <generator class="native" />
> </id>
> <property name="Name" column="name" />
> </class>
>
> >
>
--
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
-~----------~----~----~----~------~----~------~--~---