This looks like a bug, please create a stand alone test case for this.
On Thu, Sep 25, 2008 at 3:30 PM, Jamie Fraser <[EMAIL PROTECTED]>wrote:
>
> Okay, when I have 2 named queries (declared like:
>
> 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?
>
> On Thu, Sep 25, 2008 at 9:05 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
> > NHibernate will not understand 2 results sets. You will have to deal with
> > that manually.
> > You can turn that into two different queries and call them using multi
> > query, however.
> >
> > On Thu, Sep 25, 2008 at 11:04 AM, Jamie Fraser <[EMAIL PROTECTED]>
> > wrote:
> >>
> >> I'm trying to execute a stored procedure (I've also tried modifying
> >> this into a SQL statement and called it via a named query) which
> >> returns 2 result sets.
> >>
> >> 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?
> >>
> >>
> >
> >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---