0
我擁有多對多的工廠對企業關係,因爲工廠可以爲多家公司生產,而且公司可以擁有多家工廠。對於我正在開發的應用程序,我們創建了一個視圖來按照特定條件過濾公司列表。與過濾視圖的多對多關係
當我去填充我的工廠列表時,我收到一個錯誤,因爲它查找處於其連接表中的公司但在篩選後的公司視圖中沒有記錄。有沒有辦法設置這樣的設置,使沒有公司的工廠不會退回,或者我需要重新修改我的視圖設置。
例子:
Plant Table
Plant A
Plant B
Plant C
Filtered Company Table View
Company 1
Company 2
Company 3
Join Table
Plant A -> Company 1
Plant A -> Company 2
Plant B -> Company 4
Plant C -> Company 3
Plant C -> Company 4
Output -> error, company 4 does not exist
Desired Output -> Plant A(Company 1,2) - Plant C(Company 3)
我在Plant.hbm.xml文件條目。
<set name="company" table="plant_company_join_table" schema="myschema" lazy="false">
<key>
<column name="plant_id" not-null="true"/>
</key>
<many-to-many class="com.redacted.Company">
<column name="company_id" not-null="true"/>
</many-to-many>
</set>