how do i update multiple rows using Spring JPA Querydsl?

Viewed 274

I want to make the query below into a querydsl.

UPDATE goal SET next_id = CASE WHEN id = 4 then 5 WHEN id = 6 then 7 ELSE next_id END;

so i wrote code...

CaseBuilder conditionCase = new CaseBuilder();

condition.forEach(item -> conditionCase.when(table.goalId.eq(item.Id())).then(item.getNextId()));

queryFactory.update(table)
            set(table.nextId, conditionCase)

            ...

But it doesn't work.

how do i update multiple rows using Spring JPA Querydsl?

0 Answers
Related