谁能推荐一个很好的参考来使用Eclipse设置Hibernate3?
时间:2020-03-06 14:59:34 来源:igfitidea点击:
我看过一些Eclipse和Hibernate教程,而Hibernate2的教程非常好,非常直观。最近,我尝试使用Eclipse插件来设置Hibernate3,但是除了将jar文件从插件目录移动到我的lib目录之外,都无法使Hibernate工具正常工作(我不必这样做!)
解决方案
我不确定我们是否仍然需要答案,但是我们自己的stackoverflow网站可能提供了我们正在寻找的解决方案。
如果那还不能完全回答问题,那么就可以解决问题:" Hibernate和Eclipse Integration。
从链接的Hibernate网站上:
In the MANIFEST.MF file of the Hibernate plugin (which NEEDS the buddy loading), such as org.hibernate.eclipse, add a line: Eclipse-BuddyPolicy:registered and in the MANIFEST.MF file of your plugin project or RCP project, add the line: Eclipse-RegisterBuddy:org.hibernate.eclipse Important to notice the syntax - our plugin is willing to be seen by the hibernate library, using Eclipse-RegisterBuddy, and Hibernate is registering itself with Eclipse-BuddyPolicy. While this is stated clearly in the Eclipse Help (in retrospect!) it is critical to get the syntax precisely correct. Finally, if you are using HibernateUtil as your main entry point into Hibernate, then in your plugin start method add the line: Class.forName("myPlugin.HibernateUtil"); //full class name should go here This works - assumption is that hibernate.cfg.xml is in the src directory of your plugin and this is in the classpath.
希望这可以帮助你。