我有以下情况,我需要从视图中映射一些只读属性,但我需要加入一个过滤器,只有那个我需要的那个。
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="XX"
namespace="XXYY">
<subclass name="B"
extends="P"
discriminator-value="IS"
dynamic-insert="true"
dynamic-update="true"
lazy="true">
<join table="Aview" inverse="true">
<key column="ID_A" />
<property name="IdBlabla" insert ="false" update ="false" column="ID_BlaBla"/>
<property name="Tipo" insert ="false" update ="false" />
<many-to-one name="CC" column="ID_C" cascade="none" insert ="false" update ="false"/>
</join>
</subclass>
</hibernate-mapping>
如何过滤特定的ID_C ??
我只需要一个连接结果,否则我有多个对象
答案 0 :(得分:0)
我找到了一个技巧
我在键列字段中设置过滤条件,它可以工作!!!
<join table="Aview" inverse="true">
**<key column="ID_A and ID_C=:MyFilter.IdCC" />**
<property name="IdBlabla" insert ="false" update ="false" column="ID_BlaBla"/>
<property name="Tipo" insert ="false" update ="false" />
<many-to-one name="CC" column="ID_C" cascade="none" insert ="false" update ="false"/>
</join>