QueryTakeParameterSpecification has a flaw in Bind because it does not take into account the absolute limit for certain dialects which have the flag UseMaxForLimit = true. The generated SQL does not return any results when executed for a query with Take(10).Skip(10) for example.
( SELECT c1,c2
this_.Order_Date >= to_date('10/08/2011 21:00:00', 'DD/MM/YYYY HH24:MI:SS')
this_.Order_Date <= to_date('11/08/2011 20:59:59', 'DD/MM/YYYY HH24:MI:SS')
this_.Order_Date desc ) row_
The proper SQL must have rownum <= 20 clause instead of rownum <=10. The original QueryTakeParameterSpecification.Bind method always used the MaxRows corresponding to Take() without considering the dialect requirements.
Attached is the patch which solves the above issue for all dialects which require absolute limit (Oracle included).