I have the following entities
class BaseClass
{
public int Id{get; set;}
}
class SubClassOne : BaseClass
{
public string MyPropertyOne{get; set;}
}
class SubClassTwo : BaseClass
{
public string MyPropertyTwo{get; set;}
}
Now I need to display all existing entities (of type SubClassOne and SubClassTwo) in one grid, including paging.
Problem is that every Subclass has properties of its own on which the user can search and therefore needed in the query.
So, Future() is, as far as I can tell, no option because paging would not work.
In pure sql I would construct a big query with UNION. As far as I know nhibernate does not directly work with UNION. Is it somehow possible to use direct sql and then convert the result to the entities SubClassOne and SubClassTwo?
Updated:
it should work with a polymorph query
Note: you better order by the id to get consistent pages