让我们直接从文件开始:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
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">
<persistence-unit name="bd_antic" transaction-type="JTA">
<jta-data-source>jdbc/defacement_datasource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>
</persistence>
这是我的项目结构:
项目
src
--bean
--ejbEntity
... My Entity EJB for persistence.xml
--ejbSession
... My Ejb Session
我的persitence.xml就是我上面给出的那个。
它应该有效,因为
<exclude-unlisted-classes>false</exclude-unlisted-classes>
。所以我不需要通过<class></class>
但我有例外:
java.lang.IllegalArgumentException: Object: bean.ejbEntity.Page@1d4f941 is not a known entity type.
我需要帮助。所以请。