[JPA] 오류: Not a managed type: class...

현수·2022년 2월 21일
0
post-custom-banner
Caused by: java.lang.IllegalArgumentException: Not a managed type: class sch.cqre.api.domain.NotificationEntity
	at org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.java:582) ~[hibernate-core-5.6.5.Final.jar:5.6.5.Final]
	at org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.java:85) ~[hibernate-core-5.6.5.Final.jar:5.6.5.Final]
	at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:75) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:66) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:232) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:181) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:164) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:75) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324) ~[spring-data-commons-2.6.1.jar:2.6.1]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:322) ~[spring-data-commons-2.6.1.jar:2.6.1]
	at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[spring-data-commons-2.6.1.jar:2.6.1]
	at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-2.6.1.jar:2.6.1]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:328) ~[spring-data-commons-2.6.1.jar:2.6.1]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:144) ~[spring-data-jpa-2.6.1.jar:2.6.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.15.jar:5.3.15]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.15.jar:5.3.15]
	... 49 common frames omitted

하루 동안 찾아서 오류를 해결했다.

나의 경우는 resources > META-INF > persistence.xml 에 새로 추가한 NotificationEntity 클래스를 추가하지 않아 자바 스프링이 시작시 엔티티를 인식하지 못하여 발생한 문제였다.

작성하지 않은 엔티티 클래스를 작성해 넣었다.

<class>sch.cqre.api.domain.BookEntity</class>
<class>sch.cqre.api.domain.CommentEntity</class>
<class>sch.cqre.api.domain.FileEntity</class>
<class>sch.cqre.api.domain.HashTagEntity</class>
<class>sch.cqre.api.domain.PostEntity</class>
<class>sch.cqre.api.domain.PostHashTagEntity</class>
<class>sch.cqre.api.domain.ProjectEntity</class>
<class>sch.cqre.api.domain.ProjectLinkEntity</class>
<class>sch.cqre.api.domain.ProjectMemberEntity</class>
<class>sch.cqre.api.domain.RentalEntity</class>
<class>sch.cqre.api.domain.ScrapEntity</class>
<class>sch.cqre.api.domain.SupplyEntity</class>
<class>sch.cqre.api.domain.UserEntity</class>
<class>sch.cqre.api.domain.NotificationEntity</class>
post-custom-banner

0개의 댓글