Hi

I have the following query below which fails with "Criteria query
entity should match query entity" in FullTextQueryImpl. Please can
someone confirm if this is a bug? I have had to fix this in my own
compiled version (see below for fix) which I would rather avoid if
possible. If this is an issue please let me know what I can do to get
this fixed in the trunk? Thanks

var criteria = session
                .CreateCriteria(typeof (Domain.Model.Person))
                .SetFetchMode("Title", FetchMode.Join);
            var people = search.CreateFullTextQuery(query, typeof
(Domain.Model.Person))
                            .SetCriteriaQuery(criteria)
                            .List<Domain.Model.Person>();

Fix:
I changed classes[0].Name to classes[0].FullName and
ReflectHelper.ClassForName
(targetEntity) to ReflectHelper.ClassForFullName(targetEntity)

if (criteria is CriteriaImpl)
                                        {
                                                string targetEntity =
((CriteriaImpl)
criteria).EntityOrClassName;
                                                if
(classes.GetLength(0) == 1 && classes[0].FullName !=
targetEntity)
                                                {
                                                        throw new
SearchException("Criteria query entity should match
query entity");
                                                }
                                                try
                                                {
                                                        System.Type
entityType = ReflectHelper.ClassForFullName
(targetEntity);
                                                        classes = new
System.Type[] { entityType };
                                                }

-- 
You received this message because you are subscribed to the Google Groups 
"NHibernate Contrib - Development Group" 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/nhcdevs?hl=en.

Reply via email to