2013-08-14 3 views
0

아래의 최대 절전 모드 트랜잭션 실행시 다음 오류가 발생합니다. expecting DOT, found '=' near line 1, column 32 [update t_credential set status = :status , assigned_engine = :engine where id = :id].Hibernate 구문 오류 : 예상 DOT

또한 t_credential은 개체가 아닌 테이블입니다. 최대 절전 모드는이 방법을 사용하도록 허용합니까 아니면 강제적으로 개체 여야합니까? http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/batch.html#batch-direct 다음은 HQL 예에서

for(Credential credential: accountList){ 

Query query = ssn.createQuery("update t_credential set status =:status , assigned_engine = :engine where id = :id"); 
query.setParameter("status", status); 
query.setParameter("engine", assignedTo); 
query.setParameter("id", String.valueOf(credential.getId())); 
int result = query.executeUpate(); 
} 

답변

1

봐. "t_credential c 업데이트"다음에 "c.status = : status 설정"과 같이 필드를 업데이트해야합니다.

+0

감사합니다. – Aneesh

0

HQL 쿼리와 함께 Hibernate를 사용하려면 (HQL 쿼리가 아닌) 다른 기능을 사용해야 할 수도 있습니다.

ssn.createSQLQuery(" ... "); 

필자는이 기능을 사용하지 않았기 때문에 좋은 답변이라고 생각합니다. 나는 t_credential 매핑 된 객체가 아니라 테이블이어야한다 생각하지만 그것을 해결

최대

관련 문제