Framework/JPA
JPA 에러모음 1. Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: "엔티티 명"
Cs.Woo
2021. 8. 17. 23:52
#1. 원인
Gradle 빌드에서 엔티티 클래스를 자동으로 인식을 못하는 경우 발생하는 오류이다
#2. 해결
persistence.xml에 다음과 같이 class를 추가해주면 해결이 된다.
<class>프로젝트명.엔티티클래스 명</class>
예시
<persistence-unit name="유닛이름">
<class>프로젝트명.엔티티클래스 명</class>
<class>프로젝트명.엔티티클래스 명</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="DB계정"/>
<property name="javax.persistence.jdbc.password" value="비밀번호"/>
<property name="javax.persistence.jdbc.url" value="URL"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.방언종류"/>
<property name="hibernate.show_sql" value="true"/>
옵션들
..
</properties>