Joined: Fri Apr 25, 2008 8:19 am Posts: 17
|
I have two tables. One table has a many-to-one mapping to the other. I make a Criteria with selecting from table1 and SetFetchMode for the many-to-one mapping to FetchMode.Join. When the foreignkey field in the database ist null or has a valid value all works fine. The objects are loaded with only one Join-SQL. But there are many references in the database (MSSQL) with foreignkey=String.Empty instead of NULL. In this case NHibernate fires one big Join-SQL and a select for every reference which is set to String.Empty. I have about 1000 records, this means it fires 1001 select sqls. Can i configure that String.Empty is equivalent to NULL or something else? My many-ton-one mapping: <many-to-one name="Adresse" not-found="ignore" column="adrnr" access="field.pascalcase-underscore"/>
If i clear not-found="ignore" it works but i want to have null when no reference is set and not a proxy-object.
|
|