Hi all,
I would like to create a like query and filter on sub-properties. I did not find an answer in this forum although I found one topic that is related to my problem:
http://forum.hibernate.org/viewtopic.ph ... ubproperty
Mapping files:
Employment.hbm.xml => has many-to-one relation with Employee;
Employee.hbm.xml => has property "FullName";
code:
ICriteria criteria = base.Session.CreateCriteria(typeof(PID.Domain.Employment));
criteria.Add(Expression.Eq("SystemState", true));
criteria.Add(Expression.Like("Employee.FullName", EmployeeName, MatchMode.Anywhere));
When I list the criteria, I get an error "QueryException: could not resolve property".
The problem is that hibernate reads "Employee.FullName" as a single propery while FullName is a sub-propery.
When I use Expression.Eq, subproperties give no errors, only when I use Expression.Like I get this error.
Can someone tell me how to filter on sub-properties?