我正在嘗試從JBoss網站上執行Hibernate tutotial。基本上它是一個非常簡單的應用程序,它將一個事件添加到數據庫中。無法加載hiberante中的hbm文件
有一個org.hibernate.tutorial.domain.Event和一個Event.hbm.xml文件。
問題是: 不管我在做什麼,我得到一個org.hibernate.MappingNotFoundException資源:Event.hbm.xml不fohund,當我初始化配置對象。 我用來初始化,如下所示:
File hibernateCfgFile = new File("C:/Program Files/Development/IDE/workspace/Hibernate3.6/hibernate.cfg.xml");
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure(hibernateCfgFile).buildSessionFactory();
}
我試圖指定在hibernate.cfg.xml文件的完整路徑HBM文件 ,但沒有成功。
另一個奇怪的問題是我必須指定hibernate.cfg.xml的位置。而且即使它位於src文件夾中也不會找到該文件。
任何想法??
向我們展示了hibernate cfg文件 – Bozho 2011-03-19 22:01:23