是否可以使用HQL在两个表之间进行交叉连接,选择一些列然后将结果连接到第三个表。
执行我想要的SQL:
SELECT LIB.DID, DF.DFID, LIB.DCODE, LIB.OID, LIB.ODESCRIPTION, DF.VALUE FROM (
SELECT D.ID as DID, D.CODE AS DCODE, O.ID AS OID, O.DESCRIPTION AS ODESCRIPTION FROM LIBRARY D
CROSS JOIN LIBRARY O
WHERE O.TYPE = 'O'
AND D.TYPE = 'D'
) LIB
LEFT JOIN DF
ON LIB.DID = DF.D_ID AND LIB.OID = DF.O_ID
使用HQL,Criteria或类似的东西可以实现这样的目标吗?
修改:简化SQL格式并将其格式化