hibernate常见异常笔记(3)

简介: hibernate常见异常笔记(3)
org.hibernate.MappingException:
org.hibernate.MappingException: Couldnotgetconstructorfororg.hibernate.persister.entity.SingleTableEntityPersisteratorg.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:123)
atorg.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77)
atorg.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346)
atorg.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
attop.simba.dao.HibernateMMDao.fn01(HibernateMMDao.java:18)
atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)
atjava.lang.reflect.Method.invoke(UnknownSource)
atorg.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
atorg.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
atorg.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
atorg.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
atorg.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
atorg.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
atorg.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
atorg.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
atorg.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
atorg.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
atorg.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
atorg.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
atorg.junit.runners.ParentRunner.run(ParentRunner.java:363)
atorg.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
atorg.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Causedby: org.hibernate.HibernateException: Unabletoinstantiatedefaulttuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
atorg.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:91)
atorg.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:116)
atorg.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:388)
atorg.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:509)
atorg.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:124)
atsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)
atsun.reflect.NativeConstructorAccessorImpl.newInstance(UnknownSource)
atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(UnknownSource)
atjava.lang.reflect.Constructor.newInstance(UnknownSource)
atorg.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96)
  ... 29moreCausedby: java.lang.reflect.InvocationTargetExceptionatsun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)
atsun.reflect.NativeConstructorAccessorImpl.newInstance(UnknownSource)
atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(UnknownSource)
atjava.lang.reflect.Constructor.newInstance(UnknownSource)
atorg.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:88)
  ... 38moreCausedby: org.hibernate.PropertyNotFoundException: Couldnotlocategettermethodforproperty [top.simba.bean.Student#students]
atorg.hibernate.internal.util.ReflectHelper.findGetterMethod(ReflectHelper.java:400)
atorg.hibernate.property.access.internal.PropertyAccessBasicImpl.<init>(PropertyAccessBasicImpl.java:41)
atorg.hibernate.property.access.internal.PropertyAccessStrategyBasicImpl.buildPropertyAccess(PropertyAccessStrategyBasicImpl.java:27)
atorg.hibernate.mapping.Property.getGetter(Property.java:299)
atorg.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:270)
atorg.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:145)
atorg.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:63)
  ... 43more


出现这个异常有几个原因:


  • 实体类的属性对象没有设置setter或者getter,或者是设置setter或者getter时没有按照Hibernate规范。
  • 没有导入javassist的jar文件。
  • 实体类中的属性对象名和映射文件的property name不一致。
目录
相关文章
|
Java 关系型数据库 数据库连接
《Hibernate上课笔记》---class1---Hibernate简介
《Hibernate上课笔记》---class1---Hibernate简介
75 0
《Hibernate上课笔记》---class1---Hibernate简介
|
XML Java 数据库连接
《Hibernate上课笔记》----class4----Hibernate继承关系映射实现详解
《Hibernate上课笔记》----class4----Hibernate继承关系映射实现详解
98 0
《Hibernate上课笔记》----class4----Hibernate继承关系映射实现详解
|
XML Java 数据库连接
《Hibernate上课笔记》-----class5----Hibernate实现一对一关联映射
《Hibernate上课笔记》-----class5----Hibernate实现一对一关联映射
73 0
《Hibernate上课笔记》-----class5----Hibernate实现一对一关联映射
|
XML Java 数据库连接
《Hibernate上课笔记》------class6------Hibernate实现一对多关联映射
《Hibernate上课笔记》------class6------Hibernate实现一对多关联映射
64 0
《Hibernate上课笔记》------class6------Hibernate实现一对多关联映射
|
XML Java 数据库连接
《Hibernate上课笔记》-----class7----Hibernate实现多对多关联映射
《Hibernate上课笔记》-----class7----Hibernate实现多对多关联映射
99 0
《Hibernate上课笔记》-----class7----Hibernate实现多对多关联映射
|
SQL Java 数据库连接
《Hibernate上课笔记》-----class8----Hibernate的检索方式和检索策略
《Hibernate上课笔记》-----class8----Hibernate的检索方式和检索策略
112 0
《Hibernate上课笔记》-----class8----Hibernate的检索方式和检索策略
|
Java 数据库连接 数据库
《Hibernate上课笔记》----class2----Hibernate的增删改查操作
《Hibernate上课笔记》----class2----Hibernate的增删改查操作
109 0
|
SQL Java 数据库连接
《Hibernate上课笔记》-----class3----Hibernate的单实体映射
《Hibernate上课笔记》-----class3----Hibernate的单实体映射
124 0
|
Java 数据库连接
Hibernate异常信息
Hibernate异常信息
104 0
|
Java 数据库连接 数据库
hibernate常见异常笔记(11)
hibernate常见异常笔记(11)
161 0