I have an individual's object, which can have an unlimited number of first names. So the first name is another object.
i.e.
person --- name
& nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; --- name
& nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; & Nbsp; --- Name
What I want to do is writing an energetic query which I will get from a person who has definite names.
Therefore a query can be found that have Alison and Jane and Philifea, the next question may be to find a person whose names are Alison and Jane.
I just want to return those people who have all the names I am searching for. I have found it yet
Icricetia criteria = session. Creatitetria (typef (person)); Criterion Creteilles ("name", "name"); Icitratian expression = faucet; Foreign currency (name of the name in the name) (if (expression == zero) {expression = expression.Like ("name.Value", "%" + name + "%");} other {expression = expression. (Or expression Add expression (expression);
(expression; = 'zero'); ("name.Value", "%" + name + "%"));}} But this is returning to every person with all the names on which I am searching, not all names.
Can anyone help me with this? Thanks!
Or should it not be an AND-expression?
Icricaria criteria = Session. Creatitetria (typef (person)) Criterion Creteless ("name" "," Name "); foreign currency (names of names in strings) (add criteria (expression type (" name value ","% "+ name +"% "));}
Edit
Okay. To avoid joining, to match the question you provided, avoid joining it. With minor changes:
Aisitretia criteria = s.CreateCriteria (typeof (Person)); Foreach (name of strings in namesToFind) {criteria. Add (subkey "property" ("id", "name", "match", for different credentials, for example; name & gt; (). Additions (such as "value", name, match-mail, anywhere.). Property ("person"))); }
For this you have a mapped property on the name class name.
Comments
Post a Comment