Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 为什么我必须在persistence.xml中列出实体类?_Hibernate_Jpa_Persistence.xml - Fatal编程技术网

Hibernate 为什么我必须在persistence.xml中列出实体类?

Hibernate 为什么我必须在persistence.xml中列出实体类?,hibernate,jpa,persistence.xml,Hibernate,Jpa,Persistence.xml,Tomee1.6JPA2.0Hibernate2.4.8MySQL 排除未列出的类设置为false不应强制我列出实体 如果没有com.acme.Person,我会得到“未知实体com.acme.Person”。有人知道为什么吗 <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:x

Tomee1.6JPA2.0Hibernate2.4.8MySQL

排除未列出的类
设置为false不应强制我列出实体

如果没有
com.acme.Person
,我会得到“未知实体com.acme.Person”。有人知道为什么吗

<?xml version="1.0" encoding="UTF-8"?>
    <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_2_0.xsd"
     version="2.0">

<persistence-unit name="default" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.acme.Person</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>

    <properties>
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
        ...

        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.hbm2ddl.auto" value="create" />
    </properties>

</persistence-unit>

org.hibernate.ejb.HibernatePersistence
com.acme.Person
假的
...

也许这有帮助:。删除了类条目。添加了
。不走运。