我想从以下查询中仅选择 myEntity (e) 结果
String query = "select e, to_char(message_date, 'yyyyMMdd') as dateOnly from myEntity e where e.lang = 'DE' and e.message.messageDate > sysdate-5 order by dateOnly desc, e.message.messageType asc"
所以当我使用下面的代码
entityManager.createQuery(query).getResultList();
要获得结果,因为List<myEntity>
这意味着执行以下查询
select e from (select e, to_char(message_date, 'yyyyMMdd') as dateOnly from myEntity e where e.lang = 'DE' and e.message.messageDate > sysdate-5 order by dateOnly desc, e.message.messageType asc)