I have 2 tables: Parent and Child which have the following relation: Parent has many Childs.
public class Parent
{
public DateTime Timestamp;
public IList<Child> Child;
}
public Child
{
public string Name;
}
I want to select both Parent and Child, Sorted by Timestamp and get only rows between index x to y.
public IList<Parent> Get(DateTime from, DateTime to, int startRow, int count)
{
QueryOver<Parent>().Where(row => row.Timestamp >= from)
.And(row => row.Timestamp <= to).OrderBy(row => row.Timestamp).Asc.List();
}
I don't know how to get only the required rows.
Should I do it with QueryOver? or its better doing it in HQL?
Thanks
select * from Parents where RowNum between :x and :y
? – mickfold