Java
[Java] SchemaManagementException 에러 해결
Jane Kwon
2022. 5. 11. 16:57
반응형
스키마를 새로 생성한 뒤 해당 스키마에서 테이블을 생성한 경우에 SchemaManagementException이 떨어질 수 있다.
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 org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_db]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [test_db]
엔티티에 Table 어노테이션에 스키마 정보를 추가해주면 된다.
@Entity
@Table(name = "TEST_DB", schema = "TEST_SCHEMA")
반응형