EQL中使用case when..then..else..end和exists语句, 以及True和False

EQL中使用case when..then..else..end和exists语句, 以及True和False
public List<Meeting> getRecentlyMeetingsByAudit(Long candidateId, Long ownerId) {
    List<Meeting> meetings = new ArrayList<Meeting>();
    meetings = mgr.createQuery("select new com.integral7.ejb3.investigations.Meeting(m.id, m.scheduledDate, m.type.name, m.description, " +
        " case when exists(select id from MeetingAudit ma where ma.meeting = m and ma.audit.id = ?0) then True else False end) " +
        " from Meeting m " +
        " where m.owner.id = ?1 and m.scheduledDate >= ?2 order by m.scheduledDate asc")
        .setParameter(0, candidateId)
        .setParameter(1, ownerId)
        .setParameter(2, DateUtils.convertToBeginningOfDay(new Date())).getResultList();
    return meetings;
 }

这里主要注意 TrueFalse 首字母必须大写其余小写.

你可能感兴趣的:(EQL中使用case when..then..else..end和exists语句, 以及True和False)