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

报错问题运行了一次可以 第二次就一大堆错出来了

Exception in thread "main" java.lang.ExceptionInInitializerError

at com.test.Test.add(Test.java:31)

at com.test.Test.main(Test.java:19)

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 com.util.HibernateUtil.<clinit>(HibernateUtil.java:19)

... 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 grade in class com.entity.Student

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


正在回答

1 回答

把存取策略改为:access="field"

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

举报

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

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

进入课程

报错问题运行了一次可以 第二次就一大堆错出来了

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