我試圖指示休眠獲取 hibernate.cfg.xml 的相對路徑,但它不起作用,因為我寫錯了(我在文件名中輸入了 cgf 而不是 cfg)。所以我嘗試了絕對路徑,但 Hibernate 無法識別新路徑,并且仍在查看我之前通過的相對路徑。但是參數 .configure() 已經改變了,為什么 Hibernate 會忽略并堅持錯誤呢?我的代碼:private static SessionFactory buildSessionFactory() { Configuration configuration = new Configuration(); // Use the mappings and properties specified in an application resource named hibernate.cfg.xml. configuration.configure("C:\\Users\\Lucas_Pletsch\\eclipse-workspace\\PDV\\main\\resources\\hibernate.cfg.xml");顯示 Hibernate 在我之前作為參數傳遞的路徑中搜索 hibernate.cfg.xml 的錯誤屏幕:現(xiàn)在我已經嘗試過了: SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();并且錯誤信息已經改變,但是 Hibernate 仍然沒有找到 .cfg.xml:
添加回答
舉報
0/150
提交
取消