当我想创建文件hibernate.hbm.xml
时,eclipse加载错误消息如:
"发生了错误。有关详细信息,请参阅错误日志 java.lang.NullPointerException"
为什么呢?
当我运行主文件时,错误系统还有一件事我也会收到错误:
"log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;
at TestPerson.main(TestPerson.java:29)"
答案 0 :(得分:0)
Unknown entity: Person
,在hibernate配置文件中添加hibernate映射条目。
示例:
<mapping resource="com.Person.hbm.xml"/>