User.hbm.xml not found
新手请教,我的User.hbm.xml文件该放在哪?
如下,
我的项目结构如下:
myHibernate
|--src
|--entity
|--User.java
|--User.hbm.xml
|--test
|--UserTest.java
|--hibernate.cfg.xml
|--log4j.properties
我现在运行UserTest.java报如下错误:
-----------------------------------------------------------------------------------------------------------------------
Exception in thread "main" org.hibernate.MappingNotFoundException: resource: myHibernate/entity/User.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:563)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at test.UserTest.main(UserTest.java:14)