에러
[2023-08-06 18:18:45:4581][main] ERROR o.s.o.j.LocalContainerEntityManagerFactoryBean o.s.o.j.LocalContainerEntityManagerFactoryBean - Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.NullPointerException
[2023-08-06 18:18:47:6160][main] ERROR o.s.boot.SpringApplication o.s.b.SpringApplication - Application run failed
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 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.NullPointerException
원인
MSSQL 2012 버전과 jpa 연동에는 이상이 없었으나
MSSQL 2005 버전과 연동 시 에러 발생
처음에 버전 문제인 줄 알았으나 그냥 hibernate 속성 문제였다!
DB를 새로 연동하는 건데 hbm2ddl auto update 로 했으니 에러가 발생하는 것.
해결 방법
hbm2ddl.auto : update -> create
hbm2ddl:
auto: create
참고
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' 에러 해결
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;
fors.tistory.com
이렇게 쉽게 해결될 줄이야..
MSSQL 2005 버전 문제인줄 알고 시간 허비를 많이 했는데...
확실히 초반에 잘못 생각하면 그쪽으로 생각이 꽂혀서 시야가 좁아진다..
'Spring' 카테고리의 다른 글
[Springboot] SLF4j logback 로그 파일명 동적으로 변경하기 (1) | 2024.05.05 |
---|---|
[Spring] Multi DataSource 설정 시 invalid bound statement (not found) 에러 (0) | 2024.01.30 |
[Swagger] Springdoc-openapi Cors 에러 해결 방법 (1) | 2023.07.16 |
[Spring] @PostConstruct 사용 후 다른 클래스에서 호출 방법 (0) | 2022.12.20 |
[Spring][Error] Could not bind properties to 'SecurityProperties' (0) | 2022.05.02 |