0
我希望在HQL上實現以下句子。有人可以幫我把SQL語句翻譯成HQL嗎? 從設備中選擇不同的device.description,其中attribute.deviceid = 1且device.nodeid = 1的屬性 在此先感謝! 關心!HQL上的複雜句子
我希望在HQL上實現以下句子。有人可以幫我把SQL語句翻譯成HQL嗎? 從設備中選擇不同的device.description,其中attribute.deviceid = 1且device.nodeid = 1的屬性 在此先感謝! 關心!HQL上的複雜句子
這是我的嘗試:
select distinct Device.description from Device d
inner join Attribute
where d.nodeid = 1
我認爲你的類已經常規命名,你的關係是這樣的:
attribute.deviceid = device.nodeid
其實完全等同從x開始,y是交叉連接而不是內部連接。 但結果將是相同的。
你確定你不需要在內部連接之後添加一些東西嗎?就像「on attribute.device = device.node」(或「如果請求屬於attibute,則爲」fetch attribute.device「)(我猜這裏的實體屬性沒有」id後綴「) – 2011-05-05 15:49:20