The problem found in the first two days of the project, first-relucting me to describe the problem! Existing Applications Table: A (ACD, CD) Master table: B (BCD, BNM); C (CCD, CNM) Demand is such: When ACD> 1000 in the table A, BNM is queried with CD to B, Converse to the CNM. Therefore, the relationship between the A table and the B or C table cannot be set in the mapping of A. The problem is here, and there is no associated mean in Hibernate, and the HQL statement can only be inline, and the left is unable to implement. I have seen a lot of forums, there is no good solution. Most masters are called this problem, requiring to redesign the table structure, and modify mapping, but I think this needs is easy. At present, I can only divide one HQL into two writes. I really don't know, there is no better way to solve this problem, let us wait and see.