log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
at test.Test.add(Test.java:26)
at test.Test.main(Test.java:12)
Caused by: org.hibernate.MappingException: Association references unmapped class: mapping.Student
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2377)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2659)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1149)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1305)
at util.SessionUtil.<clinit>(SessionUtil.java:13)
... 2 more
这是怎么回事
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
at test.Test.add(Test.java:26)
at test.Test.main(Test.java:12)
Caused by: org.hibernate.MappingException: Association references unmapped class: mapping.Student
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2377)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2659)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1149)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1305)
at util.SessionUtil.<clinit>(SessionUtil.java:13)
... 2 more
这是怎么回事
关联的Student类没有被映射, 缺少映射文件或者路径匹配错误
2,再看Student.hbm.xml映文件,和类引入(Class="");
3,hibernate配置文件里有<mapping resource="。/Student.hbm.xml"/>。