我有3個表,我想根據某個表中的某個字段切換表。基於Hibernate條件的切換表
Table 1 (ID_table1, Type, Child_Id)
Table 2 (Id, table2_Value_1(String))
Table 3 (Id, Table3_Value_1(String))
在這裏,我想從table 2
或table 3
的Type
的基礎上table1
選擇值,並使用Child_Id
作爲涉及table 2
和table 3
外鍵。
if(Table1.type=="a") then Table 2 else table 3
我想在hibernate中這樣做。
這個問題很混亂。簡單的說,如果取出後類型解決了我腦海中的整個事情。不知道你期待什麼答案。 – Lenymm