I need to know what is the difference between JoinQueryOver and JoinAlias, and when to use each?
The difference between JoinQueryOver and JoinAlias
nhibernatequeryover
nhibernatequeryover
I need to know what is the difference between JoinQueryOver and JoinAlias, and when to use each?
Best Answer
Functionally they do the same thing, create a join to another entity. The only difference is what they return. JoinQueryOver returns a new QueryOver with the current entity being the entity joined, while JoinAlias returns the original QueryOver that has the current entity as the original root entity.
Whichever one you use is a matter of personal taste: (from http://nhibernate.info/doc/nh/en/index.html#queryqueryover)
and
Are functionally the same. Note how the kittenAlias is expressly referenced in the second query.