首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JPA - enum JOIN (JPQL)

JPA - enum JOIN (JPQL)
EN

Stack Overflow用户
提问于 2014-03-31 16:45:29
回答 1查看 395关注 0票数 0

我得到了以下JPQL查询:

代码语言:javascript
复制
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,那么查询就会编译。如果我把(正确的)枚举名称放在那里,它就不会。

映射:

代码语言:javascript
复制
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;
}

我得到的错误是:

代码语言:javascript
复制
unknown identification variable [be]. The FROM clause of the query does not declare an identification variable [be]
EN

回答 1

Stack Overflow用户

发布于 2014-03-31 17:19:10

问题解决了..忘记在包声明后包含"AttachmentType“..

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22757186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档