在学习jpa注解
在实体类上报这个错,但是运行起来却没有错
Class "org.lw.jpa.entity.Person" is mapped, but is not included in any persistence unit
这是什么原因呢?是编译器还是什么呢?
------解决方案--------------------
在resources的persistence.xml文件中
类似于;
- XML code
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="visitorPU" transaction-type="RESOURCE_LOCAL"> <class>com.cybersoft4u.example.domain.Visitor</class> <class>com.cybersoft4u.example.domain.Comment</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /> <!-- <property name="hibernate.hbm2ddl.auto" value="create-drop"/> --> </properties> </persistence-unit></persistence>