我有如下所示的Hibernate域对象:
class Player { List<Item> inventory; } class Item { List<Enchantment> enchantments; } class Enchantment { boolean isSuperiorEnchantment; }
我需要构造一个HQL查询,该查询会向我返回所有至少具有一项附有isSuperiorEnchantment标记并附有结界的物品的所有玩家的列表。我无法终生想出一种用HQL来表达这一点的方法。
isSuperiorEnchantment
有任何想法吗?
假设以上所有条件都适当,则您要查找的查询是:
select p from Player as p left join p.inventory as i left join i.enchantments as e where e.isSuperiorEnchantment = 1