I would like to use the yearweek()
function of QueryDSL, which is supported by QueryDSL. This function generates the query select year(table1.timestamp)*100 + week(table1.timestamp) as col_0_0_ [...]
. This does, however, not return a correct result on year endings. I've already opened a bug report for this issue.
I would rather use the built-in SQL yearweek()
function, which is directly supported by e.g. MariaDB. Is there a way of using the SQL function YEARWEEK(timestamp)
with QueryDSL? Or is it possible to use a custom SQL function with QueryDSL, e.g. given as a String?
Here is an example on how the two implementations return different results on year endings:
SELECT YEARWEEK("2018-01-01");
→ returns 201753, correct
SELECT YEAR("2018-01-01") * 100 + WEEK("2018-01-01")
→ returns 201800, incorrect