본문 바로가기

Programming!

Hibernate 4.x -> Hibernate 5.x 변경시 유의 사항.

그동안 JPA ( MySQL + Hibernate 4.x ) 환경에서 무난하게 개발중이던 환경에서 Hibernate를 5.0.x로 업데이트를 단행했다.


이후, entity 저장시 오류가 나기 시작했는데..hibernate_sequence에 어쩌고 저쩌고, 

Caused by: org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_sequence



대충 찾아보니

@GeneratedValue(strategy = GenerationType.AUTO) 로 ID를 지정 했을 경우 이전 버전과는 다르게 시퀀스 테이블에서 읽어 오도록 변경된듯 하다.


여튼 @GeneratedValue(strategy = GenerationType.IDENTITY) 로 변경해서 방식을 바꾸니 잘된다.