找不到持久性单元和逆向工程工具 [英] Can't find persistence unit and reverse engineering tools

查看:170
本文介绍了找不到持久性单元和逆向工程工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

< a href =http://pastebin.com/1hvHBM7z =nofollow> http://pastebin.com/1hvHBM7z



更多恰恰:


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


现在,我搜索了这个问题,它表明我应该在META-INF下有一个persistence.xml文件。事情是,这一代没有做任何关于这个文件(它甚至在我检查注释而不是在控制台配置期间检查JPA时禁用了它的生成),并且当我查看示例时,我不确定要指定什么......
另一个问题:根据我的理解,这个文件对于EntityManager是必需的,但为什么如果所有必需的信息已经存在于我的hibernate.cfg.xml中,我为什么需要这个文件(因为我的意思是,这两个文件看起来有点儿类似...)?
解析方案实际上它似乎需要持久性xml,它可以解决上述问题。然后你可能会遇到一个新的异常:找不到JDBC Driver等等。问题来自JBoss 7和Postgre9。更多信息此处(最后一篇文章)。


I'm currently creating my entities and DAO with Hibernate Tools and reverse engineering. My config is Eclipse Indigo, JBoss AS7, Hibernate Tools 3.4 and Hibernate 4. The problem is when I try to deploy my .jar to JBoss AS7 I get this :

http://pastebin.com/1hvHBM7z

And more precisely :

Can't find a persistence unit named null in deployment "businessLayer.jar"

Now, I searched about this issue and it suggests I should have a persistence.xml file under META-INF. The thing is, the generation didn't do anything regarding this file (it even disabled its generation when I checked annotations and not JPA during the console config) and when I look at the samples, I'm unsure what to specify... Another question : from what I understand, this file is necessary for the EntityManager, but why would I need this if all the required informations is already in my hibernate.cfg.xml (because I mean, the two files look kinda similar...) ?

解决方案

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).

这篇关于找不到持久性单元和逆向工程工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆