I am trying to set the fetching strategy for NHibernate Search by
using the SetCriteriaQuery of IQuery.

My domain has a one to many relationship between Target and Brands.
The code that I am using to define the fetching strategy is:

ICriteria fetchingStragtegy = fullTextSession.CreateCriteria<Target>()
                            .SetFetchMode("Brands", FetchMode.Eager)
                            .SetResultTransformer(new
DistinctRootEntityResultTransformer());

And my IQuery configuration is as follows:

IQuery fullTextQuery = fullTextSession.CreateFullTextQuery<Target>
("LastName:XXXXX")
                            .SetFirstResult(0)
                            .SetMaxResults(5)
                            .SetCriteriaQuery(fetchingStragtegy);

What I receive back is: "Criteria query entity should match query
entity" exception.

This exception is thrown at line 144 in the FullTextQueryImpl.cs in
the Nhibernate Search Source. This tells me that the classes
collection has one type in it, but the Criteria Entity Name does not
match the name in the class.

This has me stumped as I *thought* that I was dealing with"Target"
types in both the ICriteria and the IQuery.

Thoughts?

-- 
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.


Reply via email to