【发布时间】:2011-07-28 03:27:35
【问题描述】:
我有一些映射:
<class entity-name="Person" table="table1">
<id column="Id" type="long" name="Id"/>
<set name="Address">
<key column="Person_id"/>
<one-to-many class="Address"/>
</set>
<property column="Id" name="Id" type="long"/>
<property column="Last_Name" name="LastName" type="string"/>
<property column="First_Name" name="FirstName" type="string"/>
<property column="Education" name="Education" type="string"/>
</class>
<class entity-name="Address" table="table2">
<id column="Id" type="long" name="Id"/>
<property column="Id" name="Id" type="long"/>
<property column="City" name="City" type="long"/>
<property column="Street" name="Street" type="string"/>
<property column="number" name="number" type="string"/>
</class>
这是我的 HQL 查询 hbm="from person p join fetch p.Address WHERE p.id in (:ids)"
但现在我从两个表(地址和人)中选择 * 我需要重新定义姓氏、人名和包含 City 、 Street 的 Addresses 集合的 HQL
我如何在地址字段上添加条件??
【问题讨论】:
-
有什么想法吗??可能是不可能的??
标签: nhibernate hql