If you are using SQL Server, you can do that with a SQLQuery like this:
Code:
string sql = @"With ProjectTree( uid ) as
(
select p.uid from sx.bus_project p where parentuid = :uid
union all
select p.uid from sx.bus_project p inner join ProjectTree t on p.parentuid = t.uid
)
select uid from ProjectTree";
session.CreateSQLQuery( sql.Replace( ":uid", projectUId.ToString()) )
.AddScalar( "uid", NHibernateUtil.Int64 )
.List( projectUIds );
In this example, I only retrieve the ids, but entities should work as well. I'm not sure why I replaced the parameter instead of using .SetParameter(), maybe that didn't work here.