2010/10/28 Luca7993 <[email protected]>:
> Hi,
> I have three small questions on nhibernate using:
>
> -it's possible to make the refresh of more entities in one single
> round trip to database?
>
> -I have lazy load activated and also the second cache:
> If I load a list of 150 entities (A), that have a many-to-one
> relationship with another entities (B) (that are only few elements of
> B...about 20), if entities B are not already in cache, there will be
> "select n+1" query when I use A.B with lazy.
> Is a good practice loading the B entities with a GetAll, before load
> the list of A entities?

Google for batch-size that you can apply in your mappings. NHibernate
can be configured to load multiple "expected needed" B instances when
the first one is accessed.
For this particular usecase, with only a small number of B, I guess
GetAll() could also work.

>
> -if I need to load a list of 200 entities (A) that have a one-to-one
> relationship with another Entities B, but in this case I need only one
> properties of B (for example description), what should I need do?
> can I "tell" to nhibernate to load only the property description of B
> entity?

Would it solve an actual problem if you could?
You can use projections to load only specific data from the DB, but
then it would no longer be your entities - it would just be a view of
you data. Can be useful in reporting scenarios.

/Oskar

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