[queryDSL][SqlException]You can't specify target table for update in FROM clause


[queryDSL][SqlException]You can't specify target table for update in FROM clause

원인 You can't specify target table for update in FROM clause 본인이 mysql를 쓰고 있는가? 서브쿼리 만들때 자기테이블은을 또 바라보고 있는가? mysql은 이런 서브쿼리를 지원하지 않는다. 에러가 났다. 간단하다 서브쿼리에 같은 테이블을 쓰지 말자 어차피 서브쿼리를 쓰면 성능이 실제로도 떨어진다. 해결방안 기존 코드 queryFactory .update(testEntity) .set(testEntity.testCheck, 1) .where(testEntity.id.in( JPAExpressions .select(testEntity.id) .from(testEntity) .where(testEntity.testCheck.ne(1)) .where(testEntity.typeType.eq(element.getType())) .orderBy(testEntity.id.asc()) .limit(element.getCount()))) .execu...


#clause #fromclause #qeurydsl #queryDSL #sqlexception #sql에러 #targerTable #update #you

원문링크 : [queryDSL][SqlException]You can't specify target table for update in FROM clause