日期:2014-05-20  浏览次数:20857 次

ibernate 的报异常 请教那位大侠帮我解决啊!我找了好久不找到那出错啊!
&&&&&&&&&&&&&&&&&&
Environment - Hibernate 3.2.5
Environment - hibernate.properties not found
Environment - Bytecode provider name : cglib
Environment - using JDK 1.4 java.sql.Timestamp handling
Configuration - configuring from resource: /hibernate.cfg.xml
Configuration - Configuration resource: /hibernate.cfg.xml
Configuration - Reading mappings from resource : com/ghc/date/bean/Empt.hbm.xml
HbmBinder - Mapping class: com.ghc.date.bean.Empt -> EMPT
Configuration - Configured SessionFactory: null
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Association references unmapped class: com.ghc.date.bean.Empdept
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2380)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2662)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
at com.ghc.SessionFactory.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
at com.ghc.DaoImpl.EmptImpl.findall(EmptImpl.java:52)
at com.ghc.DaoImpl.EmptImpl.main(EmptImpl.java:104)
Configuration - configuring from resource: /hibernate.cfg.xml
Configuration - Configuration resource: /hibernate.cfg.xml
Configuration - Reading mappings from resource : com/ghc/date/bean/Empt.hbm.xml
Mappings - duplicate import: com.ghc.date.bean.Empt->com.ghc.date.bean.Empt
Mappings - duplicate import: com.ghc.date.bean.Empt->Empt
HbmBinder - Mapping class: com.ghc.date.bean.Empt -> EMPT
%%%% Error Creating SessionFactory %%%%
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/ghc/date/bean/Empt.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
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 com.ghc.SessionFactory.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)
at com.ghc.SessionFactory.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)
at com.ghc.DaoImpl.EmptImpl.findall(EmptImpl.java:52)
at com.ghc.DaoImpl.EmptImpl.main(EmptImpl.java:104)
Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping com.ghc.date.bean.Empt.empdepts
at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2066)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2041)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:359)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144)
at org.hibernate.cfg.Configuration.add(Configuration.java:669)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:504)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
... 9 more
Exception in thread "main" java.lang.NullPointerException
at com.ghc.DaoImpl.EmptImpl.findall(EmptImpl.java:53)
at com.ghc.DaoImpl.EmptImpl.main(EmptImpl.java:104)


------解决方案--------------------
<set name="empdepts" inverse="true">
<key>