SW개발/Spring Framework

hibernate SQL Error: 1064, SQLState: 42000

개소왕 2017. 5. 31. 13:17

SQL Error: 1064, SQLState: 42000

[ERROR][2017-05-30 00:34:33,766][JDBCExceptionReporter][logExceptions] 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1


hql = ".... IN :myVar";

c.setParameterList("myVar", lstVar);


형태의 코드에서 lstVar 의 null 인 경우


hql -> sql 과정에서 

... in () 으로 생성되어 발생하는 오류 (로 추정)



* 해결

- lstVar 에 null 넘오 오지 않도록 처리

- setParameterList 대신 setParameter() 사용하지 않아야 함



* 다른 경우 - 컬럼 명을 sql 예약어 사용해서 충돌

http://egloos.zum.com/javalove/v/902047