Hi,
I have a trouble with criteria search.
Let's say these tables and records are in the database:
Tbl1:
ID Name Tbl2ID
1 ........ 1
2 ........ 1
3 ........ NULL
4 ........ 2
Tbl2:
ID Name
1 ........
2 ........
3 ........
The first class Tbl1 has a property of type Tbl2. This relation is many-to-one.
I need a criteria for searching in Tbl1 like:
criteria.CreateAlias(Tbl2, "tbl2");
criteria.Add(Expression.Eq("tbl2.ID", 1));
NHibernate throws an exception, because of the NULL value.
What is the solution here? Please, help.
|