Currently org.hibernate.engine.spi.SubselectFetch#createSubselectFetchQueryFragment cuts off everything after the order by and also does not do the limit handling. Since in 6.x we will rework the limit handler code to work on an SQL AST instead of strings, this will be a lot easier to implement. Since I am planning to implement support for limit/offset also in subqueries, this will be easily fixable in 6.0. |