nhibernate - QueryOver and null check on optional reference -
i have user 1-1 relation optional userdata. sharing same identifier in db. user id(x => id, "id") references<userdata>(x => x.userdata, "id"); userdata id(x => id, "id") i query users no optional data. query makes null check on user id column. var list = session.queryover<user>() .where(x => x.userdata != null) this case if use hasone. assuming mapping : public class usermap : classmap<user> { public usermap() { table("usertable"); id(x=>x.id).column("id"); hasone(x => x.data); } } public class userdatamap : classmap<userdata> { public userdatamap() { table("userdatatable"); id(x => x.id).column("id"); map(x=>x.datatext).column("datatext"); } } you may try : userdata userdata...