First result set is the data (search results, essentially).
Second result set is the count of results.
I'm not sure if a Multiquery is the right thing to use - from what I
understand a MQ will allow me to execute N queries in a batch and
present single results for each one, whereas I want to execute a
single query and get 2 results from it.
Can anyone advise what to do?
var fullTextSearchQuery = session.GetNamedQuery("FullTextSearch")
.SetResultTransformer(Transformers.AliasToBean(typeof(SearchResultItem)))
.SetString("SearchString", searchString)
.SetInt32("PageSize", searchParams.NumberResults)
.SetInt32("PageNumber", searchParams.PageNumber);
var fullTextCountQuery = session.GetNamedQuery("FullTextCount")
.SetString("SearchString", searchString)
.SetInt32("PageSize", searchParams.NumberResults)
.SetInt32("PageNumber", searchParams.PageNumber);
They both work fine.
However if I do
var results = session.CreateMultiQuery()
.AddNamedQuery("FullTextSearch")
.AddNamedQuery("FullTextCount")
.SetString("SearchString", searchString)
.SetInt32("PageSize", searchParams.NumberResults)
.SetInt32("PageNumber", searchParams.PageNumber)
.List();
I get an error saying "query must begin with SELECT or FROM"
What am I doing wrong?
Test case attached - just remember and point it to any local DB via
hibernate.cfg.xml (the named queries are very simple, they don't
actually hit any tables so it won't matter which DB NH points to).
-Jamie