【发布时间】:2014-05-10 12:47:36
【问题描述】:
我有以下 JPQL 查询:
select cio from CadastralIncomeObjection cio where cio.dateInput < :maxValidInputDate and cio.active = true and cio.reasonInValid.valid = false "
+ "and exists (select dd from DocumentDossier dd join dd.documents d where dd.id = cio.id and d.attachmentType = be.ejb.model.entity.admin.option.REPORT)"
一切都很好,除了使用枚举。如果我会做 d.anyOtherField = someValue 查询确实编译。如果我把(正确的)枚举名称放在那里,它不会。
映射:
package be.ejb.model.entity.dossier;
@Entity
@Table(name = "DOCUMENT")
public class Document {
@Column(name = "T_I_TYA", nullable = false)
@Enumerated(EnumType.STRING)
private AttachmentType attachmentType;
/* other fields etc */
}
package be.ejb.model.entity.admin.option;
public enum AttachmentType {
REPORT;
}
我得到的错误:
unknown identification variable [be]. The FROM clause of the query does not declare an identification variable [be]
【问题讨论】: