我有一个休息库:
@Query(
"SELECT ord FROM Order as ord where " +
" (:#{#customer} is null or :#{#customer}='' or ord.customer = :#{#customer}) and " +
" (:#{#supplier} is null or :#{#supplier}='' or ord.supplier = :#{#supplier} ) and " +
" (:#{#startDate} is null or :#{#startDate}='' or ord.date >= :#{#startDate} ) and " +
" (:#{#endDate} is null or :#{#endDate}='' or ord.date >= :#{#endDate} )"
)
Page<Order> query(
@Param("customer") Organization customer,
@Param("supplier") Organization supplier,
@DateTimeFormat(pattern = "dd-MM-yyyyy") @Param("startDate") Date startDate,
@DateTimeFormat(pattern = "dd-MM-yyyyy") @Param("endDate") Date endDate,
Pageable pageable
);
当我在没有任何参数的情况下调用查询时,它可以正常工作并返回每个订单。如果我提供任何一个参数而不提供其余参数,我会得到org.hibernate.QueryException: Not all named parameters have been set
。有解决方案吗?
答案 0 :(得分:0)
您将SpEL与实体名称和绑定参数混合在一起。对于绑定使用&#39;:parameterName&#39;不是&#39;:#{#parameterName}&#39;
Sub prepravljeno()
Sheet1.Activate
Sheet1.Range(Range("C3"), Range("C3").End(xlDown)).Copy
Sheet2.Activate
Sheet2.Range(Range("C4"), Range("C4").End(xlDown)).PasteSpecial
Sheet7.Activate
Sheet7.Range(Range("C3"), Range("C3").End(xlDown)).Copy
Sheet2.Activate
Sheet2.Range("C4" & Rows.count).End(xlUp).Offset(1).PasteSpecial
Sheet6.Activate
Sheet6.Range(Range("C3"), Range("C3").End(xlDown)).Copy
Sheet2.Activate
Sheet2.Range("C4" & Rows.count).End(xlUp).Offset(1).PasteSpecial
Sheet5.Activate
Sheet5.Range(Range("C3"), Range("C3").End(xlDown)).Copy
Sheet2.Activate
Sheet2.Range("C4" & Rows.count).End(xlUp).Offset(1).PasteSpecial
Sheet4.Activate
Sheet4.Range(Range("C3"), Range("C3").End(xlDown)).Copy
Sheet2.Activate
Sheet2.Range("C4" & Rows.count).End(xlUp).Offset(1).PasteSpecial
MsgBox "Podaci iz kolone 'Naziv aktivnosti' kopirani u list 'Baza aktivnosti'"
End Sub