2

我目前正在使用 Hibernate 工具和逆向工程创建我的实体和 DAO。我的配置是 Eclipse Indigo、JBoss AS7、Hibernate Tools 3.4 和 Hibernate 4。问题是当我尝试将我的 .jar 部署到 JBoss AS7 时,我得到了这个:

http://pastebin.com/1hvHBM7z

更准确地说:

在部署“businessLayer.jar”中找不到名为 null 的持久性单元

现在,我搜索了这个问题,它表明我应该在 META-INF 下有一个 persistence.xml 文件。问题是,这一代并没有对这个文件做任何事情(当我在控制台配置期间检查注释而不是 JPA 时,它甚至禁用了它的生成),当我查看示例时,我不确定要指定什么......另一个问题:据我了解,这个文件对于 EntityManager 是必需的,但是如果所有必需的信息都已经在我的 hibernate.cfg.xml 中,为什么我需要这个(因为我的意思是,这两个文件看起来有点相似...... ) ?

4

1 回答 1

0

Actually it seems you need to have the persistence xml, which get rid of the issue above. Then you're likely to have a new exception : JDBC Driver not found etc. The problem came from JBoss 7 and Postgre9 for me. More information here (last post).

于 2012-07-17T15:19:35.797 回答