hibernate. mappingException:no persister

 在使用session的save()方法保存實體類數據的時候報這個異常,原因是木有對對象持久化,也就是忘記在hibernate.cfg.xml 引用 實體類的XX.hbm.xml。

報錯:


net.sf.hibernate.MappingException: No persister for: szapp.domain.webqc.HpJobRecord
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:441)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2286)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2293)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:614)
at szapp.web.ctl.qc.LpEmpBaseInfoSubmit.saveJobRecord(LpEmpBaseInfoSubmit.java:350)
at szapp.web.ctl.qc.LpEmpBaseInfoSubmit.doProcessData(LpEmpBaseInfoSubmit.java:122)
at szapp.web.ctl.qc.LpEmpBaseInfoSubmit.insidePerform(LpEmpBaseInfoSubmit.java:87)
at junit.LimsRegSubmitTest.<init>(LimsRegSubmitTest.java:98)
at junit.LimsRegSubmitTest.main(LimsRegSubmitTest.java:114)

說明:對象木有持久化

在hibernate.cfg.xml 中 木有 配置 HpJobRecord.hbm.xml
解決方法:在hibernate.cfg.xml 中添加

這裏寫圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章