티스토리 뷰
;; 상황
- save 시 duplicate entry 발생
18:29:37,218][JDBCExceptionReporter][logExceptions] SQL Error: 1062, SQLState: 23000
[66.249.79.18][ERROR][2017-12-19 18:29:37,236][JDBCExceptionReporter][logExceptions] Duplicate entry '3205361' for key 'PRIMARY'
[66.249.79.18][ERROR][2017-12-19 18:29:37,236][AbstractFlushingEventListener][performExecutions] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at
- 두개의 서버가 1개 DB 접근하는 상황
- 해당 개체는 generator class = increment 로 설정된 상태
- db table AUTO INCREMENT 설정 된 상태
;; 해결
generator class = identity 로 변경하여 해결
increment 는 WAS 에서 직접 ID 생성하여 Insert
그러나 MySQL 은 AUTO INCREMENT 적용시 ID 생성하지 않아도 알아서 생성함
'SW개발 > Spring Framework' 카테고리의 다른 글
Hibernate/ ClassNotFoundException (0) | 2018.04.25 |
---|---|
Spring MVC request URL 가져오기 (0) | 2018.03.01 |
spring mvc ${} 리스트 못 읽어옴 (0) | 2017.10.31 |
Hibernate /Not all named parameters have been set (0) | 2017.10.31 |
hibernate SQL Error: 1064, SQLState: 42000 (0) | 2017.05.31 |