I built a similiar solution but in just one trip to DB:
DetachedCriteria subQuery = ...//-->Add all Criterions you want and inclusive "SetFirstResult" and "SetMaxResults"
DetachedCriteria rootQuery = DetachedCriteria.For(); // where T is an entity
subQuery.SetProjection(
Projections.Distinct(
Projections.ProjectionList().Add(Projections.Alias(Projections.Property("ID"), "ID"))
)
);
// Note: all my entities inherit from a base class who contains a property "ID"
rootQuery.Add(Subqueries.PropertyIn("ID", subQuery));
// ...then use rootQuery to get the List of T and no repeated item will be retrieved.
I hope someone find this implementation helpfull :)
Román