简体   繁体   中英

JPA - enum JOIN (JPQL)

I've got the following JPQL query:

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)"

everything is ok, except the use of the enum. If I would do d.anyOtherField = someValue the query does compile. If I put the (correct) enum name there it does not.

Mapping:

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;
}

The error i'm getting:

unknown identification variable [be]. The FROM clause of the query does not declare an identification variable [be]

问题已解决。.忘记在包声明后包括“ AttachmentType”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM