Euh.... Anthony, what was the final word with this issue? I am a NHibernate user and it does look like the current (1.0.1) release works in the same way.
Big pb for me since my legacy db has an "Inactive" flag everywhere and all apps are supposed to ignore all inactive values.
The "where" element in class declaration seem to be ignored in most of collections and associations:
For example a Employee->User association
Class Employee:
Code:
<class name="Employee, MyApp" table="Employee" where="inactive=0" >
…
<many-to-one name="User" class="User, MyApp"
column="UserId" unique="true" not-null="false" >
Class User:
Code:
<class name="User, MyApp" table="Users" where="inactive=0" >
Would generate SQL:
SELECT… FROM Employee this LEFT OUTER JOIN Users user1_ ON this.UserId=user1_.id WHERE this.inactive=0
= user1_.inactive=0 is missing.
The User objects will be retrived ignoring the "inactive" flag on Users table. Similar behaviour with <bag>, <one-to-one> and others.
I wouldn't mind at all hacking NHib code, but I've seen posts from Gavin that seemed to indicate that this is by design (not quite the same case though).
[/code]