I have 3 classes, Addin, Application and Database. Each addin can have many applications and each application has only 1 database. I want to get 1 addin and fetch all applications with their databases.
Addin<-> Application= 1:m
Application <-> Database= 1:1
This query only fetches the applications. How to fetch the database:
var result session.CreateCriteria<Addin>()
.SetFetchMode("applications", FetchMode.Eager)
.Future<Addin>();
result.ToList();
Try to use joins or you can change the mapping options to load the Database together with the Application (I suppose that in the model you have Database as property of Application)
It will look smth. like