728x90
2022-03-04 18:49:24.636 ERROR 19788 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unsupported property type [java.security.Timestamp] for @CreationTimestamp or @UpdateTimestamp generator annotation
2022-03-04 18:49:24.637 WARN 19788 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unsupported property type [java.security.Timestamp] for @CreationTimestamp or @UpdateTimestamp generator annotation
자꾸 에러가남
entity 생성 시간을 자동으로 입력해주는
@CreationTimeStamp를 갖다 쓰려고 하는데 지원하지 않는 property type이라고함
[에러 이유 후보]
- hibernate 버젼이 안 맞음
stackoverflow 해결 출처 : https://stackoverflow.com/questions/49254104/spring-boot-timestamp
Your import is wrong. As @raviiii1 suggested, instead of java.security.Timestamp use java.sql.Timestamp
알고보니 TimeStamp를 import java.security.Timestamp;로 땡겨 써서 그런 것 같음
성공.
[에러 이유]
Timestamp를 잘못된 라이브러리에서 import했었다.
import java.security.Timestamp; (X)
import java.sql.Timestamp; (O)