Can't find persistence unit and reverse engineering tools

寵の児 提交于 2019-12-11 02:58:36

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/11512555/cant-find-persistence-unit-and-reverse-engineering-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!