Java hibernate eclipse bin 目录
我正在使用 hibernate 并将 xml 映射文件放在 src/hib 目录中。 但是当调试应用程序eclipse运行目录是bin。 是否可以将 Eclipse 也将映射的 .xml 文件复制到 bin/hib 目录? 谢谢。
I am using hibernate and put xml mapping files in src/hib directory.
but when debug application eclipse run directory is bin.
Is possible to forse Eclipse also copy .xml files of mapping also to bin/hib directory?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Eclipse 应该自动完成它。问题是 Hibernate 默认从默认包加载其配置文件,而不是从
hib
包中加载。请注意,它不会通过从当前目录打开文件来加载它。它将它作为资源从类路径加载。即使配置文件最终位于 jar 文件中,只要它位于包树中的预期位置(即树的根部),Hibernate 也能够加载它。
Eclipse should do it automatically. The problem is that Hibernate, by default, loads its config file from the default package, and not from the
hib
package.Notice that it doesn't load it by opening a file, from the current directory. It loads it as a resource from the classpath. Even if the config file ends up in a jar file, Hibernate will be able to load it, provided it is at the expected location in the package tree (i.e. at the root of the tree).