Panache 实体 - 在投影到 DTO 期间 Panache 实体中出现 QuerySyntaxException 意外标记

Panache Entity - QuerySyntaxException unexpected token in panache entity during projection to DTO

我正在尝试在 Quarkus 中投影我的实体,但我总是遇到错误 QuerySyntaxException: unexpected token:member

这是模型:

@Entity
@Table(name = "key_performance_indicator")
public class KeyPerformanceIndicator extends PanacheEntity {
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name = "fk_member")
    public Member member;

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name = "fk_execution")
    public KpiValuationExecution kpiValuationExecution;
}

DTO:

public class KpiResourceDTO {

private KpiIdentifier identifier;
private LocalDate timestamp;
private Double value;
private Set<MetricDTO> metrics;


public KpiResourceDTO(KpiIdentifier identifier,  Double value) {
    this.identifier = identifier;
    this.value = value;
}
//getters,setters 
}

投影代码:

Map<String, Object> params = new HashMap<>();
params.put("execution", execution);
params.put("user", member);
KeyPerformanceIndicator.find("member=:user and kpiValuationExecution=:execution",params).project(KpiResourceDTO.class).list();

在最后一行执行投影后,出现以下错误:

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: member near line 1, column 168 [SELECT new sk.KpiResourceDTO (identifier, value) FROM sk.KeyPerformanceIndicator WHERE member = ?1]

我已经检查了上述实体中是否存在 NULL 值。根据 quarkus 版本的文档尝试了不同的方法来放置 find 方法的参数:

但是没有任何成功。

能否建议我解决问题的任何步骤? 谢谢!

嘿,我刚刚解决了它。 Member 当然是 JPQL 关键字 :/