So I'm on an NHibernate crash course, and kinda hit a snag with the example below.
Suppose I have the following .NET class:
class A {
int id;
int type_var;
List<B> someCollection;
}
class B {
int id;
string someText;
}
I'll probably map it like :
<class name="A" table="A">
<id name="id" type="Int32">
<generator type="identity" />
</id>
<property name="type_var" />
<set name="someCollection" table="B">
<key name="fk_aid" />
<composite-element class="B">
<property name="someText" />
</composite-element>
</set>
</class>
My problem is, how would you change this mapping if we were only interested in getting those B elements that belong to A (via fk_aid) AND has a type_var value equal to A (let's assume that both A and B have a type_var column, but they're not explicitly related).
I'm thinking that I'll have to work with something like a where clause here?
<set name="someCollection" table="B" where="type_var = type_var">
How exactly would one do this?