JPQL에서 문제가 있습니다. 나는 JPQL에서 Spring을 사용하여 다른 객체 값으로 객체를 업데이트하는 방법 JPA
class Department{
private Long id;
private String name;
public void setId(Long id){
this.id = id;
}
public void setName(String name){
this.name = name;
}
public Long getId(){
return id;
}
public String getName(){
return name;
}
}
지금 내가
Employee
의 부서를 업데이트해야합니다 ...이 아래
class Employee{
private Long id;
private String name;
private Department department;
public void setId(Long id){
this.id = id;
}
public void setName(String name){
this.name = name;
}
public void setDepartment(Department department){
this.department = department
}
public Long getId(){
return this.id;
}
public String getName(){
return this.name;
}
public Department getDepartment(){
return this.department;
}
}
같은 엔티티와 있습니다. 나는 아래의 쿼리를 시도했다.
update Employee e set e.department.id = 'XXX' where e.id in (?1);
내가이 문제를 해결할 수있는 방법
java.lang.IllegalStateException: org.hibernate.hql.internal.QueryExecutionRequestException: Not supported for DML operations.
당신이 나를 인도시겠습니까 같은이주고 예외?
건배, 테자.
감사합니다 올리버 ... U는 내 시간을 저장했습니다. – Tej