我的开发环境(IBM RAD 8 + WAS 8)抱怨我的项目没有 persistence.xml 文件。看来我仍然可以构建和运行我的项目。是否需要该文件,如果添加一个这样的文件以使我的项目通过验证,该文件中应该包含什么?
该项目是一个 Web 项目,它使用来自其他项目的会话 bean 和实体 bean,并且这个 persistence.xml 错误是项目中唯一的错误,所以我很乐意摆脱它。
谢谢你的帮助
更新
我在我的文件中搜索了 persistence.xml,它显示在 EJB 项目的 src/ 和 bin/ 中,而具有 servlet 和 jsp 的 Web 项目没有 persistence.xml,据我的同事说,Web 项目正在使用持久性。来自 EJB 项目的 xml,即:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="PandoraArendeWeb" transaction-type="JTA">
<jta-data-source>jdbc/Mainframe_TEST_ADBUTV2</jta-data-source>
<class>se.prv.pandora.arendeprocess.entity.PRVNummer</class>
<class>se.prv.pandora.arendeprocess.entity.Ansokan</class>
<class>se.prv.pandora.arendeprocess.entity.NatAnsokan</class>
<class>se.prv.pandora.arendeprocess.entity.PctAnsokan</class>
<class>se.prv.pandora.arendeprocess.entity.ArendePerson</class>
<class>se.prv.pandora.arendeprocess.entity.Nyregistrering</class>
<class>se.prv.pandora.arendeprocess.entity.Anstalld</class>
<class>se.prv.pandora.arendeprocess.entity.Handlaggare</class>
<class>se.prv.pandora.arendeprocess.entity.OrgElement</class>
<class>se.prv.pandora.arendeprocess.entity.FysiskHandlaggare</class>
<class>se.prv.pandora.arendeprocess.entity.AnsvarigHandlaggare</class>
<class>se.prv.pandora.arendeprocess.entity.AnsvarigFysiskHandlaggare</class>
<class>se.prv.pandora.arendeprocess.entity.TeknikOmrade</class>
<class>se.prv.pandora.arendeprocess.entity.Person</class>
<class>se.prv.pandora.arendeprocess.entity.PRVNummerPerson</class>
<class>se.prv.pandora.arendeprocess.entity.Notering</class>
<class>se.prv.pandora.arendeprocess.entity.Lock</class>
<class>se.prv.pandora.arendeprocess.entity.LandKod</class>
<class>se.prv.pandora.arendeprocess.entity.ArbetsMomentLog</class>
<class>se.prv.pandora.arendeprocess.entity.SystemTypDel</class>
<class>se.prv.pandora.arendeprocess.entity.ArbetsMoment</class>
<class>se.prv.pandora.arendeprocess.entity.UnderStatus</class>
<class>se.prv.pandora.arendeprocess.entity.PatPers</class>
<class>se.prv.pandora.arendeprocess.entity.PrvLandP</class>
<class>se.prv.pandora.arendeprocess.entity.PkaPerln</class>
<class>se.prv.pandora.arendeprocess.entity.PctnPerl</class>
<class>se.prv.pandora.arendeprocess.entity.PersonToPatPersKoppl</class>
<class>se.prv.pandora.arendeprocess.entity.PRVNummerPersonKoppl</class>
<class>se.prv.pandora.arendeprocess.entity.Region</class>
<class>se.prv.pandora.arendeprocess.entity.Historik</class>
<class>se.prv.pandora.arendeprocess.entity.Egenskap</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<!-- <persistence-unit name="PandoraArendeWeb_MSSQL" transaction-type="JTA">
<jta-data-source>jdbc/MSSQL_TEST_XA</jta-data-source>
<class>se.prv.pandora.arendeprocess.entity.PersonSearch</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
-->
</persistence>