select distinct groupMember.proUcer.proUserDetail
from proGroupMembership groupMember
where groupMember.proGroup.id =:groupId and groupMember.status = 1
order by groupMember.proUcer.proUserDetail.firstName


ORA-01791异常
当我执行此查询时。
经过大量研究,我通过选择另外一列来解决该问题,我们通过以下方式对订单进行了应用:
所以我根据该解决方案转换查询

select distinct groupMember.proUcer.proUserDetail, groupMember.proUcer.proUserDetail.firstName
from proGroupMembership groupMember
where groupMember.proGroup.id =:groupId and groupMember.status = 1
order by groupMember.proUcer.proUserDetail.firstName


现在我的问题是我只需要对象列表,但是query.list()返回对象数组的列表。
请帮我解决这个问题。

最佳答案

不要在查询中重复自己。使用联接:

select distinct proUserDetail
from proGroupMembership groupMember
join groupMember.proUcer proUcer
join proUcer.proUserDetail proUserDetail
where groupMember.proGroup.id = :groupId and groupMember.status = 1
order by proUserDetail.firstName

关于java - hibernate 4完全不同并按顺序排列,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32664821/

10-10 11:42