Hi NHibernaters
I have the following db tabel
Code:
------------------------
| id | parentId | name |
| 1 | 2 | john |
| 2 | -1 | james |
...
-------------------------
And the following mapping
Code:
<class name="customer" table="customer">
<property name="name" column="name" />
<many-to-one name="parent" column="parentId" not-found="ignore" />
</class>
And following class
Code:
public class Customer
{
public string name { get; set; }
public Customer parent { get; set;}
}
When getting a customer, I notice in a profiler that there are queries to the db like the following
Code:
Select * from Customer Where id = -1
This obviously results in zero rows, cause there will never be a customer with id -1.
How can I tell NHibernate that such a query is useless, and the it can return zero, without querying the DB.Need more info, please don't hesitate to ask.
Thanks for your time and effort.
EDIT: I noticed that this topic should be in the .Net section, however it is not .Net specific. SorryRegards
Wim