【发布时间】:2013-02-10 20:56:58
【问题描述】:
我正在使用 EclipseLink 运行一些本机 SQL。我需要将数据返回到 POJO。我按照EclipseLink Docs 的说明进行操作,但收到错误Missing descriptor for [Class]
已命名查询列以匹配 POJO 的成员变量。我需要做一些额外的映射吗?
POJO:
public class AnnouncementRecipientsFlattenedDTO {
private BigDecimal announcementId;
private String recipientAddress;
private String type;
public AnnouncementRecipientsFlattenedDTO() {
super();
}
public AnnouncementRecipientsFlattenedDTO(BigDecimal announcementId, String recipientAddress, String type) {
super();
this.announcementId = announcementId;
this.recipientAddress = recipientAddress;
this.type = type;
}
... Getters/Setters
实体管理器调用:
public List<AnnouncementRecipientsFlattenedDTO> getNormalizedRecipientsForAnnouncement(int announcementId) {
Query query = em.createNamedQuery(AnnouncementDeliveryLog.FIND_NORMALIZED_RECIPIENTS_FOR_ANNOUNCEMENT, AnnouncementRecipientsFlattenedDTO.class);
query.setParameter(1, announcementId);
return query.getResultList();
}
【问题讨论】:
标签: jpa eclipselink