Kim Seong Jun
Kim Seong Jun

Reputation: 11

Complex where clause in QueryDSL

Any one help for this Mysql query to QueryDSL Predicates?

i'm using QueryDSL 2.9.0 + Spring-data-jpa 1.3.2 + hibernate

select itemkey, issuedt, writedate
from Taxinvoice
where
DATEDIFF(writeDate,ifnull((select closeDate from IssueCloseDate where YearMonth = date_format(writedate,'%Y%m'))
,Date_Add(Date_Add(writeDate,interval 10-day(writedate) DAY), interval 1 MONTH))) > 0

Can it be done? :(

I really appreciate any help you can provide.

Upvotes: 0

Views: 765

Answers (1)

Timo Westkämper
Timo Westkämper

Reputation: 22200

This can't be expressed in JPA, you will need to use SQL for this. Querydsl supports SQL via Querydsl SQL and Querydsl JPA native queries.

Upvotes: 1

Related Questions