hi all, i have this entity/table
User
{
long Id,
string Name,
int Age
}
i have a list of couple name-age to search for but i don't know how to
do it.
this is the bad way to get the result that i want
//note names.length == ages.length
public IList<User> GetAllByNameAndAge(string[] names, int[] ages)
{
IList<User> allUsers = NhSession.CreateQuery("from
User").List<User>();
IList<User> filteredUser = new List<User>();
foreach(User u in allUsers)
{
for (int i = 0; i < names.length; i++)
{
if (names[i] == u.Name && ages[i] == u.Age)
{
filteredUsers.Add(user);
}
}
}
return filteredUsers;
}
i need to do a hql query (or criteria or sql, no linq becouse it's a
2.0 project) that will do it on the db side.
sorry if it's a stupid question but i'm not good with sql/hql query
and i haven't idea of how to do it.
thanks
--
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.