I m trying to make a projection of my entities in Quarkus, but i m always getting an error QuerySyntaxException: unexpected token:member
Here is the Model:
@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;
}
The 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
}
And the projection code:
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();
After the execution of the projection on the last line i m getting the following error:
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]
I have checked whether there is a NULL value within the mentioned entity. Tried different approaches to put the arguments for find method based on the documentation of quarkus version:
But without any sucess.
Can you please suggest me any steps to resolve it? Thanks!
CodePudding user response:
Hey I have just resolved it. Member is JPQL keyword of course :/