为了账号安全,请及时绑定邮箱和手机立即绑定

错误好多,新手无法解决啊,求老师帮忙?

Exception in thread "main" java.lang.ExceptionInInitializerError

at org.hibernate.entity.Test.add(Test.java:24)

at org.hibernate.entity.Test.main(Test.java:10)

Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister

at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)

at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)

at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:399)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)

at org.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:20)

... 2 more

Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)

at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)

at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:403)

at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:520)

at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:148)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)

... 6 more

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)

... 15 more

Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for gdesc in class org.hibernate.entity.Grade

at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:310)

at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:304)

at org.hibernate.mapping.Property.getGetter(Property.java:323)

at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:411)

at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:200)

at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:80)

... 20 more


正在回答

2 回答

同学我也遇到了同样的问题,你解决了吗?

0 回复 有任何疑惑可以回复我~
#1

Shawn_Mei

解决了,是映射文件出了问题。
2016-07-29 回复 有任何疑惑可以回复我~
#2

withyou王杰

怎么解决的,哪里的错误
2016-08-01 回复 有任何疑惑可以回复我~
#3

Shawn_Mei 回复 withyou王杰

看看你的班级hbm.xml文件里的org.hibernate.entity.Grade路径写的对不对,大小写有没有区分
2016-08-02 回复 有任何疑惑可以回复我~
#4

withyou王杰 回复 Shawn_Mei

大小写是要跟数据库里的一样吗
2016-08-02 回复 有任何疑惑可以回复我~
#5

withyou王杰 回复 Shawn_Mei

都是对的就是报我的映射文件找不到,但是我可以通过Ctrl点得进去
2016-08-02 回复 有任何疑惑可以回复我~
查看2条回复

Could not find a getter for gdesc in class org.hibernate.entity.Grade

你的Grade类的gdesc字段没有getter方法

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Hibernate初探之一对多映射
  • 参与学习       42171    人
  • 解答问题       295    个

Hibernate中一对多关联映射配置,以及cascade和inverse属性作用

进入课程

错误好多,新手无法解决啊,求老师帮忙?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信