我得到了以下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]发布于 2014-03-31 17:19:10
问题解决了..忘记在包声明后包含"AttachmentType“..
https://stackoverflow.com/questions/22757186
复制相似问题