eventhough我已經正確地構建我的項目,當我收到錯誤映射Employee.hbm.xml如下:冬眠的.hbm.xml文件映射錯誤
這裏是我的異常代碼
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.viralpatel.hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java:16)
at net.viralpatel.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:8)
at net.viralpatel.hibernate.Main.list(Main.java:26)
at net.viralpatel.hibernate.Main.main(Main.java:75)
Caused by: org.hibernate.MappingNotFoundException: resource: net/viralpatel/hibernate/Employee.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:738)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2188)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2160)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2140)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2093)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2008)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1987)
at net.viralpatel.hibernate.HibernateUtil.buildSessionFactory(HibernateUtil.java)
對此的任何建議..
你是如何創建項目的? – yousafsajjad
你可以發佈..'Employee.hbm.xml'和'hibernate.cfg.xml'嗎?例外顯示在執行時找不到'Employee.hbm.xml' – kark
Employee.hbm的路徑是什麼? xml和hibernate.cfg.xml? – erencan