1

I have a query statement like this:

  @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)

There is one parameter and i want to set it into the position ?1, but i got a error message:

Using named parameters for method public abstract Purchase PurchaseRepository.getByTrackingNo(java.lang.String) but parameter 'trackingNo' not found in annotated query ' select t.pt_note, t.tracking_no from T_EC_PURCHASE t where regexp_like( t.pt_note, '^(.[^[:digit:]]+)?(?1)([^[:digit:]]+.)?$', 'n')'!

The purchase is my entity, and here is 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
}

Did I miss something?

ColdFire
  • 6,764
  • 6
  • 35
  • 51
xmcx
  • 283
  • 3
  • 18
  • Check out this [jpa native Query regexp like with querydsl](https://stackoverflow.com/questions/49984210/jpa-native-query-regexp-like-with-querydsl), maybe it helps you. – xmcx Jul 12 '19 at 10:14

0 Answers0