벌크 연산
public class JpaMain {
public static void main(String[] args) {
String qlString = "update Product p "
+ "set p.price = p.price * 1.1 "
+ "where p.stockAmount < :stockAmount";
int resultCount = em.createQuery(qlString)
.setParameter("stockAmount", 10)
// 영향받은 Entity 수를 반환한다.
.executeUpdate();
}
}지원 쿼리
주의사항
해결 방안




@Modifying

Last updated