eclipse下,用hibernate访问oracle。出现如下错误。跪求解答!
Exceptioninthread"main"java.lang.ExceptionInInitializerErroratdao.impl.UserDaoHiberna...
Exception in thread "main" java.lang.ExceptionInInitializerError
at dao.impl.UserDaoHibernateImpl.saveUser(UserDaoHibernateImpl.java:17)
at test.DaoTest.main(DaoTest.java:13)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource domain/User.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 org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at dao.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 2 more
Caused by: org.hibernate.PropertyNotFoundException: field [name] not found on domain.User
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:122)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:114)
at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:137)
at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:83)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:71)
at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2174)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2151)
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 展开
at dao.impl.UserDaoHibernateImpl.saveUser(UserDaoHibernateImpl.java:17)
at test.DaoTest.main(DaoTest.java:13)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource domain/User.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 org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at dao.HibernateUtil.<clinit>(HibernateUtil.java:14)
... 2 more
Caused by: org.hibernate.PropertyNotFoundException: field [name] not found on domain.User
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:122)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:114)
at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:137)
at org.hibernate.util.ReflectHelper.getter(ReflectHelper.java:83)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:71)
at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:276)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2174)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2151)
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 展开
展开全部
具体代码贴出来才知道。
看这里 :
org.hibernate.PropertyNotFoundException: field [name] not found on domain.User
貌似是 你User对象中的属性不匹配造成的。
检查你的User.hbm.xml中相关配置
看这里 :
org.hibernate.PropertyNotFoundException: field [name] not found on domain.User
貌似是 你User对象中的属性不匹配造成的。
检查你的User.hbm.xml中相关配置
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
帖代码。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询