I recently had the need to investigate a way to do some complicated projections with Criteria queries and I was faced with what seems a common problem: being able to fully select the properties of the root entity of the criteria. An issue has been raised on NHibernate JIRA and there are some questions on StackOverflow about it. Criteria projections are powerful, but not much documented. I decided to try to understand the problem and find a solution for it. Eventually, I ended um implementing not only a RootEntityProjection but also a generic
EntityProjection. RootEntityProjection selects all the properties of the criteria’s root entity and EntityProjection selects all the properties of any joined entity, selected by its alias. An example for the RootEntityProjection could be:
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here. NHibernate does not support outer (left, right, full) joins in most of its querying APIs, namely, Criteria, Query Over, LINQ and HQL. Of course, LINQ is translated into HQL, so as long as HQL does not support it, nothing really can be done about it. Do note that this problem also happens in Hibernate for Java, it has to do with the way NHibernate/Hibernate is implemented, both can only join entities that are related through some navigation property. It
is, though, possible to perform left joins with SQL. One example is:
I few weeks ago I posted about my new Nokia Lumia 1520 “phablet”: Lumia 1520- First thoughts Tomorrow my new Lumia 1020 will replace the 1520. Why? Because the 1520 is just too big. Otherwise I really like it in a lot of ways – high def screen, easy to read content, very fast, slot for MicroSD card. But it doesn’t fit nicely into my pockets, and it is very awkward to hold up to my ear when talking (yes, I often use BlueTooth, but not always). Mostly though, even with my big hands (I’m 2m tall after all) I can’t use it
Microsoft is offering business users some useful Windows 8.1 tips, tricks and how-to content via a new blog-post series.
Microsoft looks to be ready to trade OEMs a cheaper version of Windows 8.1 in exchange for shipping new devices with Bing preloaded as the default search engine.
The Visual Studio 2013′s Find and Replace Dialog provides the option for the user to find and replace text in the project using regular expressions or wildcards. To enable the Regular... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]