I have a class with property of list.
public class Paperboy{
private int _id;
private string _lastname;
private string _firstname;
privat
Seems like NHibernate < 4 has a bug with creating the join. With the help of Radim Köhler and firo (see other Post) I ended up using HQL:
select
paperboy
from
Paperboy as paperboy
left join
paperboy._additionalPhoneNumbers number
where
paperboy._mobile = :nr or
paperboy._phone = :nr or
number = :nr
It is also possible to avoid the join by using :nr in elements(paperboy._additionalPhoneNumbers)
but than I could not replace some characters in the additional number.
Almost the same answer I just gave to previous NHibernate question: QueryOver IList<string> property
Based on this Q & A: NHibernate How do I query against an IList property?
Where I tried to show that (as mentioned in the documentation) we can use magical word ".elements"
:
So the query which will touch the string elements in your case
//or.Add(Restrictions.Eq("AdditionalPhoneNumbers", number));
or.Add(Restrictions.Eq("AdditionalPhoneNumbers.elements", number));
And that will support filtering IList<string>