1

我有这样的查询语句:

  @Query(value =
"select t.pt_note, t.tracking_no" +
  "  from T_EC_PURCHASE t" +
  " where regexp_like(t.pt_note," +
  "                   '^(.*[^[:digit:]]+)?(?1)([^[:digit:]]+.*)?$'," +
  "                   'n')", nativeQuery = true)

有一个参数,我想将其设置到位置 ?1,但我收到一条错误消息:

为方法 public abstract Purchase PurchaseRepository.getByTrackingNo(java.lang.String) 使用命名参数,但在带注释的查询中找不到参数 'trackingNo' ' select t.pt_note, t.tracking_no from T_EC_PURCHASE t where regexp_like( t.pt_note, '^( . [^[:digit:]]+)?(?1)([^[:digit:]]+. )?$', 'n')'!

购买是我的实体,这里是 PurchaseRepository:

trait PurchaseRepository extends JpaRepository[Purchase, String] with QueryDslPredicateExecutor[Purchase] {

  @Query(value =
    "select t.pt_note, t.tracking_no" +
      "  from T_EC_PURCHASE t" +
      " where regexp_like(t.pt_note," +
      "                   '^(.*[^[:digit:]]+)?(?1)([^[:digit:]]+.*)?$'," +
      "                   'n')", nativeQuery = true)
  def getByTrackingNo(trackingNo: String): Purchase
}

我错过了什么?

4

0 回答 0