독립 실행 형 JPA 도구 인 maven 프로젝트가 있습니다.JPA2 엔티티를 자동 검색 할 수 없습니다.
이 주요 프로젝트는 모든 엔티티 클래스를 포함하는 다른 프로젝트에 의존합니다.
그러나 JPA는 내 항목을 자동으로 찾지 않습니다. My Eclipse 프로젝트> properties> jpa> 자동 발견도 가능합니다.
내 persistence.xml을 : 그것은 대상/클래스/META-INF에 위치
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="myapp-ds" transaction-type="RESOURCE_LOCAL">
<description>Vecchio</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/myapp" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="xxx" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.archive.autodetection" value="class"/>
</properties>
</persistence-unit>
</persistence>
.
오류, 엔티티를 사용하는 경우 것은 :
Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: model.legacy.dto.myentity
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1184)
at it.test.Main.main(Main.java:23)
모든 수업을 나열하고 싶지는 않습니다. 수업은 400+ –