如何在内部联接中编写AND子句,即休眠HBM文件中的一对多映射?

时间:2018-10-08 08:41:22

标签: java hibernate

这是我的hbm配置,需要在其中添加AND子句以对此进行过滤。

<set name="maintenanceLineItems_" lazy="false">
  <meta attribute="scope-set">protected</meta>
  <meta attribute="scope-get">protected</meta>
  <key column="PARENT_ENTITLEMENT_ID"/>
  <one-to-many class="com.flexnet.operations.bizobjects.MaintenanceItemDO"/>
</set> 

现在查询为:

select
  maintenanc0_.ID as col_0_0_ 
       from OPS_MAINTENANCE_ITEM maintenanc0_ 
       inner join
           OPS_ENTITLEMENT_ORDER entitlemen1_ 
               on maintenanc0_.PARENT_ENTITLEMENT_ID=entitlemen1_.ID  
       where
           entitlemen1_.ID=? 
           and maintenanc0_.STATUS<>? 
           and maintenanc0_.TENANT_ID=?

但是我需要像这样的查询:

select
  maintenanc0_.ID as col_0_0_ 
       from OPS_MAINTENANCE_ITEM maintenanc0_ 
       inner join
           OPS_ENTITLEMENT_ORDER entitlemen1_ 
               on maintenanc0_.PARENT_ENTITLEMENT_ID=entitlemen1_.ID  and entitlemen1_.TENANT_ID=? 
       where
           entitlemen1_.ID=? 
           and maintenanc0_.STATUS<>? 
           and maintenanc0_.TENANT_ID=?

0 个答案:

没有答案