哪个缺少以下内容JPQL query
?
SELECT h FROM WorkFlowHistory h WHERE h.referenceNo = :referenceNo
AND h.workflowTask IN ('CONFIRMATION','PAYMENT','ISSUING')
错误 :
invalid IN expression argument [CONFIRMATION]
动态查询方法
public List<WorkFlowHistory> findWorkFlowHistoryByRefNo(String refNo, WorkflowTask ...workflowTasks) {
...
StringBuffer buffer = new StringBuffer("SELECT h FROM WorkFlowHistory h WHERE h.referenceNo = :referenceNo");
if(workflowTasks != null && workflowTasks.length > 0) {
buffer.append(" AND h.workflowTask IN (");
for (int i = 0; i < workflowTasks.length; i++) {
buffer.append("'" + workflowTasks[i] + "'");
if ((i + 1) != workflowTasks.length) {
buffer.append(",");
}
}
buffer.append(")");
}
Query q = em.createQuery(buffer.toString());
....
}
我的枚举类
public enum WorkflowTask {
UNDERWRITING("Underwriting"),
SURVEY("Survey"),
APPROVAL("Approval"),
INFORM("Inform"),
CONFIRMATION("Confirmation"),
PAYMENT("Payment"),
PROPOSAL_REJECT("Proposal Reject"),
ISSUING("Issuing");
private String label;
private WorkflowTask(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
}