2013-08-14 5 views
0

을 설정하지 I가 다음과 같은 예외 오류 :org.hibernate.QueryException : 모든 매개 변수가

Caused by: org.hibernate.QueryException: Not all named parameters have been set: [c] 
[UPDATE EtudeCredit e SET e.avisfin=:c WHERE e.codeEc=:idEc] 

내 코드입니다 :

public EtudeCredit updateavisfin(Integer id, String avisfint) { 
     Query d= entityManager.createQuery("UPDATE EtudeCredit e SET e.avisfin=:c WHERE    e.codeEc=:idEc"); 
     d.setParameter("idEc",id).executeUpdate(); 
     d.setParameter("c",avisfint).executeUpdate(); 
     return (EtudeCredit) d.getSingleResult();} 

어떤 도움? 뭐가 잘못 되었 니?

답변

0

두 매개 변수가 모두 설정되면 executeUpdate()으로 한 번 전화해야합니다. 이제는 두 번 부릅니다.

d.setParameter("idEc",id); 
d.setParameter("c",avisfint); 
d.executeUpdate(); 
+0

내가 지금 말한 것처럼 executeupdate를 변경했습니다. DML OPERATION에 대해 지원되지 않습니다. –

0

두 매개 변수를 설정하기 전에 두 번 업데이트하려고합니다. 당신이 그것을에 "getSingleResult"를 발급 할 수 있도록

d.setParameter("idEc",id); 
d.setParameter("c",avisfint); 
d.executeUpdate(); 

ALOS가 업데이트 문에는 "지속성 개체 결과를"없다 : 먼저 매개 변수를 설정 한 다음 업데이트를 실행해야합니다. 업데이트 후 결과를 검색하려면 다른 쿼리 (SELECT 문)를 만들어야합니다.

관련 문제