By API features I mean on each path/fetch/... If in general, NHibernate has
a nice "set of APIs" :)
--
Mohamed Meligy
Senior Developer (Microsoft Technologies - Technical Delivery)
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Direct:  +971   2 4045385
Mobile: +971 50 2623624, +971 55 2017 621

E-mail: [email protected]
Weblog: http://gurustop.net


On Thu, Jun 10, 2010 at 1:37 AM, Mohamed Meligy <[email protected]>wrote:

> 2 queries (especially if in the same transaction) is better (In general,
> one select each per path/table/fetch/relation/{name_it}). This is super nice
> when the batch size is equal to N of selects (or using Future to have the
> same effect).
>
> Having this by default in another ORM (commercial, LLBLGen) with flexible
> API for paging/ordering/etc was the main feature I missed when I switched to
> NHibernate. The page Diego refers to has a good explanation and discussion
> on the topic (the post and some of the comments also).
>
> --
> Mohamed Meligy
> Senior Developer (Microsoft Technologies - Technical Delivery)
> Injazat Data Systems
> P.O. Box: 8230 Abu Dhabi, UAE.
>
> Direct:  +971   2 4045385
> Mobile: +971 50 2623624, +971 55 2017 621
>
> E-mail: [email protected]
> Weblog: http://gurustop.net
>
>
>
> On Wed, Jun 9, 2010 at 11:59 PM, Diego Mijelshon 
> <[email protected]>wrote:
>
>> SetMaxResults and eager fetch of collections don't mix.
>> This is one approach to collection eager loading:
>> http://ayende.com/Blog/archive/2010/01/16/eagerly-loading-entity-associations-efficiently-with-nhibernate.aspx
>> <http://ayende.com/Blog/archive/2010/01/16/eagerly-loading-entity-associations-efficiently-with-nhibernate.aspx>In
>> your case you can't use Future, but you can still to it in 2 queries instead
>> of N+1.
>>
>>    Diego
>>
>>
>>
>> On Wed, Jun 9, 2010 at 15:43, curlyfro <[email protected]> wrote:
>>
>>> if i don't add SetMaxResult i get back everything in a single query.
>>> if i set FetchMode.Join & SetMaxResult then i get Tracks.
>>> if i set FetchMode.Select & SetMaxResult then i get Albums but i get
>>> Select N + 1 not a single query.
>>>
>>> how do i get 10 Albums in a single query?
>>>
>>> On Jun 9, 2:27 pm, "Jim Case" <[email protected]> wrote:
>>> > use a fetch mode of join instead of eager.
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > -----Original Message-----
>>> > From: [email protected] [mailto:[email protected]] On
>>> Behalf
>>> >
>>> > Of curlyfro
>>> > Sent: Wednesday, June 09, 2010 2:26 PM
>>> > To: nhusers
>>> > Subject: [nhusers] Problem using SetFetchMode in NHibernate
>>> >
>>> > i've got this method:
>>> >
>>> >         public IEnumerable<Album> GetAllAlbumsWithTracks()
>>> >         {
>>> >             var albums = Session.CreateCriteria(typeof(Album))
>>> >                 .SetFetchMode("Tracks", FetchMode.Eager)
>>> >                 .SetResultTransformer(new
>>> > DistinctRootEntityResultTransformer()).Future<Album>();
>>> >
>>> >             return albums;
>>> >         }
>>> >
>>> > but if i .SetMaxResult(10), i get back 10 Tracks.  how do i get back
>>> > 10 Albums?
>>> >
>>> > --
>>> > 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]<nhusers%[email protected]>
>>> .
>>> > For more options, visit this group athttp://
>>> groups.google.com/group/nhusers?hl=en.
>>> >
>>> > No virus found in this incoming message.
>>> > Checked by AVG -www.avg.com
>>> > Version: 9.0.819 / Virus Database: 271.1.1/2897 - Release Date:
>>> 06/09/10
>>> > 02:35:00
>>>
>>> --
>>> 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]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>>
>>  --
>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>

-- 
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.

Reply via email to