I am stuck in customizing one of my queries ... here's my scenario ...
< P> I have a domain simulator for Twitter where a user can follow another user. So here's a sample of my user model: User - & gt; Followers (many-to-many users) - & gt; The following (many-to-many users) I now need to return the user's pager results after the user 'XYZ', but it is also necessary to find out that currently Logged in user is following the returning followers.
So somehow I need to load this curious: user-> follower-> The following is possible to do this in 1 query, or I'll need to do 2 separate questions: ( only current data for the current user) In order to return the paged data of followers, 1 query is returned, then in the other query, to bring the following data to the user, the IN segment is returned with the returned ID.
< / P> Div class = "post-text" itemprop = "text">
Let you get the data Questions are required, but you can execute both questions on the same trip using NHibernate futures methods.
In your scenario you want to do something like this
Var user = session.CreativeReuters () .SetFetchMode ("Followers", FethMode.Eager). Add (Restrictions. Eq ("Id", User ID). Future Value & lt; Users & gt; ; (); Session. Creative Arts & lt; User & gt; () Etfet Mood ( "following", FethModekEager). Add (sanctions. AEC ( "ID" User ID). Future Value & lt; Users & gt; ();
Comments
Post a Comment