找不到hibernate.cfg.xml
我刚开始冬眠。。我使用netbeans IDE,我设置了所有东西。。在运行示例应用程序时,我将所有的stuffconfiguration和mapping文件放入了一个名为myfirsthibernate的包中。示例应用程序显示错误,因为找不到文件hibernate.cfg.xml。但是它在我的第一个Hibernate包中。如何纠正这种情况以及为什么会发生这种情况找不到hibernate.cfg.xml,hibernate,Hibernate,我刚开始冬眠。。我使用netbeans IDE,我设置了所有东西。。在运行示例应用程序时,我将所有的stuffconfiguration和mapping文件放入了一个名为myfirsthibernate的包中。示例应用程序显示错误,因为找不到文件hibernate.cfg.xml。但是它在我的第一个Hibernate包中。如何纠正这种情况以及为什么会发生这种情况 请帮助我,谢谢..hibernate.cfg.xml也需要在您的类路径中。也许可以编写一个ant任务,为您自动执行此复制。另外,请参见
请帮助我,谢谢..hibernate.cfg.xml也需要在您的类路径中。也许可以编写一个ant任务,为您自动执行此复制。另外,请参见。hibernate.cfg.xml也需要位于类路径中。也许可以编写一个ant任务,为您自动执行此复制。另外,请参见。默认情况下,hibernate.cfg.xml文件位于/src/java/resource中,默认情况下,该文件位于classpath目录中。你能试着把cfg文件放在那里吗
你能给我一些关于你项目目录结构的更多信息吗 默认情况下,hibernate.cfg.xml文件放置在/src/java/resource中,默认情况下该文件位于classpath目录中。你能试着把cfg文件放在那里吗
你能给我一些关于你项目目录结构的更多信息吗 假设您的项目结构类似于src>myfirsthibernate>[一些文件],则表示hibernate希望在默认情况下在类路径的根目录下找到hibernate.cfg.xml文件。所以为了像这样开始冬眠 SessionFactory sf=new Configuration.configure.buildSessionFactory 您的目录结构应该如下所示
>src
>myfirsthibernate
>[your entity classes and mapping files here]
>hibernate.cfg.xml
如果希望将文件保存在myfirsthibernate包下,则需要在配置过程中添加其位置:
SessionFactory sf=新配置
.configuremyfirsthibernate/hibernate.cfg.xml
.buildSessionFactory 假设您的项目结构类似于src>myfirsthibernate>[一些文件],则表示hibernate希望在默认情况下在类路径的根目录下找到hibernate.cfg.xml文件。所以为了像这样开始冬眠 SessionFactory sf=new Configuration.configure.buildSessionFactory 您的目录结构应该如下所示
>src
>myfirsthibernate
>[your entity classes and mapping files here]
>hibernate.cfg.xml
如果希望将文件保存在myfirsthibernate包下,则需要在配置过程中添加其位置:
SessionFactory sf=新配置
.configuremyfirsthibernate/hibernate.cfg.xml
.buildSessionFactory src->myfirsthibernate->hibernate.cfg.xmldirectory:src/main/resources/hibernate.cfg.xmlIt在我的例子中仍然没有找到,我使用netbeans和Windows作为OSsrc->myfirsthibernate->hibernate.cfg.xmldirectory:src/main/resources/hibernate.cfg.xmldirectory在我的例子中仍然没有找到,我使用netbeans和Windows作为操作系统