I spent pretty much all day getting several different bugs worked out of the criteria subquery projection code. Several of the bugs that I worked on were in the sql 2005 paging code, so if people had problems getting things to work before it may be worth taking a look at this patch. I have a passing unit test that uses:
* Filter Parameters
* Criteria Subqueries
* Sorting
* Paging
* Subquery and outer query restrictions
* Relationships in subquery and outer query
It was a major pain to get all of these pieces working together... but I'm now using it in my application to do auto-column sorting on a grid view off of a subselect which is 4 relationships away from the primary entity!
The previous sql 2005 paging code assumed that it needed to create an alias for everything it was going to page such as: "__hibernate_sort_expr_1__" This caused missing parameters to occur in subselects and I believe other things such as switch-case statements. I've replaced this with some logic that determines if that exact same column or subquery is already being selected and doesn't duplicate it if so. This also means easier to debug log files. :)
Enjoy...
-Will