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

Hibernate 问题
%%% Error Creating SessionFactory %%%%
org.hibernate.PropertyNotFoundException: Could not find a getter for studentAddresses in class com.qjkj.twohibernate.po.StudentInfo
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.mapping.Property.getGetter(Property.java:272)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:125)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.qjkj.twohibernate.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
at com.qjkj.twohibernate.student.StudentDAO.queryStudent(StudentDAO.java:69)
at com.qjkj.twohibernate.student.MainTest.main(MainTest.java:11)
%%%% Error Creating SessionFactory %%%%
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/qjkj/twohibernate/po/BookInfo.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.qjkj.twohibernate.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)
at com.qjkj.twohibernate.hibernate.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)
at com.qjkj.twohibernate.student.StudentDAO.queryStudent(StudentDAO.java:69)
at com.qjkj.twohibernate.student.MainTest.main(MainTest.java:11)
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.qjkj.twohibernate.po.BookInfo
at org.hibernate.cfg.Mappings.addClass(Mappings.java:118)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)
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
java.lang.NullPointerException
at com.qjkj.twohibernate.student.StudentDAO.queryStudent(StudentDAO.java:72)
at com.qjkj.twohibernate.student.MainTest.main(MainTest.java:11)


------解决方案--------------------
看看你的数据表映射文件和你的JAVABEAN是不是一致的
------解决方案--------------------
Java code

rg.hibernate.PropertyNotFoundException: Could not find a getter for studentAddresses in class com.qjkj.twohibernate.po.StudentInfo

------解决方案--------------------
探讨
看看你的数据表映射文件和你的JAVABEAN是不是一致的

------解决方案--------------------