一个用户有多个卖家用户表
<set name="eters" inverse="true" cascade="all" fetch="join" >
<key>
<column name="CustomerId" />
</key>
<one-to-many class="com.logistics.bean.Marketer" />
</set>
卖家表
<many-to-one name="customerInfo" class="com.logistics.bean.CustomerInfo">
<column name="CustomerId" />
</many-to-one>查询的时候 hibernate 发出 left out join
这样就如果有3条卖家 , 就会用重复3条记录为了减少查询,才用fetch ="join"的, 不用的话就没有重复记录
有什么办法可以改变left out join这种连接方式,去掉重复记录呢?
<set name="eters" inverse="true" cascade="all" fetch="join" >
<key>
<column name="CustomerId" />
</key>
<one-to-many class="com.logistics.bean.Marketer" />
</set>
卖家表
<many-to-one name="customerInfo" class="com.logistics.bean.CustomerInfo">
<column name="CustomerId" />
</many-to-one>查询的时候 hibernate 发出 left out join
这样就如果有3条卖家 , 就会用重复3条记录为了减少查询,才用fetch ="join"的, 不用的话就没有重复记录
有什么办法可以改变left out join这种连接方式,去掉重复记录呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货