我有一个 JPA 选择:
select c.name, f.id from Child c left join c.father
预期结果是:
Child 1  |  1
Child 2  |  2
Orphan   | null
但我抓住了
Child 1  |  1
Child 2  |  2
Orphan   |  0  // ZERO ?
我能够解决这个选择
select c.name, case when (f.id is null) then null else f.id end from Child c left join c.father
我可以设置一些设置以避开解决方法?