How use rownumber window function in JPAQuery ?

232 views
Skip to first unread message

Никита Романов

unread,
Nov 22, 2023, 7:26:24 PM11/22/23
to Querydsl
Hi all, I am noob in QueryDSL and face problem, which I couldn't resolve using QueryDSL,
I need write JPAQuery<>() with rowNumber function in select section.I am using JDK17, 
spring-boot-starter-data-jpa 2.5.14 and querydsl (core/jpa/sql) 5.0.0 

 I wrote function like this:
WindowFunction<Long> rowNumber = rowNumber().over().orderBy(tableOne.field, tableTwo.field, tableThree.field);

or like this:

SQLExpressions.rowNumber().over()
                .orderBy(retailSeekPrice.regionCode, product.productTypeCode, product.alcCode)
                .as("rowNumber");

Also I tried use Expressions.stringTemplate()

If u met issue like this or know how use row_number in JPAQuery, please text me.

With best regards,  Nikita Romanov!
 
Reply all
Reply to author
Forward
0 new messages