Hi Thomas,

I had some problem with the use of fetch mode myself. My problem, as
far as I remerber, was that I used fetch mode "join" with a HQL query.

I understand the documentation that this is not supported:

>>> NHibernate reference, p. 116
...
The fetch strategy defined in the mapping document affects:
• retrieval via Get() or Load()
• retrieval that happens implicitly when an association is navigated
• ICriteria queries
• HQL queries if subselect fetching is used
...
<<<

I changed my HQL query into a criteria query and voila, it worked.

HTH,
Marc

On 26 Mai, 13:40, Thomas Koch <[email protected]> wrote:
> Hello everyone.
>
> I want to optimize the loading of data in my domain model.
>
> In the past I have used MultiCriteria to load data from different
> tables "in one go" to the database.
>
> However, is it possible to use something similar to MultiCriteria to
> have NHibernate load an entity and its association in one go?
>
> For instance, if I have a domain model like this:
>
> A -* B -* C
> |
> *
> D
>
> Translation: Entity A has a collection of B and D, and B in turn has a
> collection of D.
>
> I tried using FetchMode = Join and Fetch for the associations when
> loading A, but the loading still gives rise to separate selects
> against the database (at least according to Ayendes NHprofiler).
>
> In theory I could use MultiCriteria to load the data of A, B, C and D
> as in one go, but as I understand it the instances thus loaded will
> not be "wired together". So even though all the Bs of A was loaded,
> doing A.Bs will still cause the B's to be loaded.
>
> Does anyone know if its possible to achieve something similar to the
> MultiCriteria where NHibernate is still wiring the entities together?
>
> Regards
> Thomas
--~--~---------~--~----~------------~-------~--~----~
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