小错误引发大问题
在配置文件中将id的generator值increament写成了inreament造成了下面的错误。找的好辛苦啊。悲哀。
?
?
org.hibernate.MappingException: could not instantiate id generator
?at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:97)
?at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
?at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
?at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
?at com.flyinsky.eagle.user.util.DBUtil.<clinit>(DBUtil.java:31)
?at com.flyinsky.eagle.user.dao.UserDAO.addUser(UserDAO.java:185)
?at com.flyinsky.eagle.user.test.TestHibernate.main(TestHibernate.java:36)
Caused by: org.hibernate.MappingException: could not interpret id generator strategy: inrement
?at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:108)
?at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:91)
?... 6 more
%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not read mappings from resource: com/flyinsky/eagle/user/po/userInfor.hbm.xml
?at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
?at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
?at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
?at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
?at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
?at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
?at com.flyinsky.eagle.user.util.DBUtil.rebuildSessionFactory(DBUtil.java:69)
?at com.flyinsky.eagle.user.util.DBUtil.getSession(DBUtil.java:53)
?at com.flyinsky.eagle.user.dao.UserDAO.addUser(UserDAO.java:185)
?at com.flyinsky.eagle.user.test.TestHibernate.main(TestHibernate.java:36)
Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping com.flyinsky.eagle.user.po.UserInforPO.allAddress
?at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)
?at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2030)
?at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2005)
?at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:368)
?at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
?at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
?at org.hibernate.cfg.Configuration.add(Configuration.java:386)
?at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
?at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
?... 9 more
Exception in thread "main" java.lang.NullPointerException
?at com.flyinsky.eagle.user.dao.UserDAO.addUser(UserDAO.java:186)
?at com.flyinsky.eagle.user.test.TestHibernate.main(TestHibernate.java:36)