hibernate在写cfg配置文件自动创建表时报错org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister

在用hibernate框架时,写cfg文件,想自动生成表时,一般写<property name="hibernate.hbm2ddl.auto">create</property>,即数据库有没有表都会先删除后重新创建映射关系中该有的表。此异常为hibernate映射异常,无法为单个实体类得到构造函数。说明是cfg中的对应hbm的mapping的其中一个出了问题,去看一下其中每一个hbm文件,找到错误,是否某个property中的属性拼写错误等。

原文地址:https://www.cnblogs.com/wisir/p/8743479.html