在Intellij中找不到/hibernate.cfg.xml [英] /hibernate.cfg.xml not found in Intellij
问题描述
现在,我正在使用IntelliJ学习Hibernate.因此,我创建了一个Maven项目并创建了一个Hibernate程序.但是然后我得到了一个错误,如这张图片中的显示.
然后,我在Internet上搜索解决方案.但是我找不到任何正确的解决方案.
如果您在Intellij Idea中工作,请在src \ main \ java下创建一个名为"resources"的文件夹.打开项目的模块"设置,从左侧选择模块",然后在源"选项卡中选择新创建的资源"文件夹,并将其标记为资源". >
然后这应该工作.
Configuration con = new Configuration().configure("hibernate.cfg.xml");
Now a days, I am learning Hibernate using IntelliJ. So, I created a Maven project and created a Hibernate program. But then I have got an error like the show in this image.
Then I searched for solutions in the Internet. But I can't find any correct solution.
If you are working in Intellij Idea then make a folder named "resources" under src\main\java. Open Module setting of your project, select "Modules" from left and in the "sources" tab select the newly created "resources" folder and mark it as "Resources".
then this should work.
Configuration con = new Configuration().configure("hibernate.cfg.xml");
这篇关于在Intellij中找不到/hibernate.cfg.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!