码上敲享录 > Hibernate常见问题解答 > 解决org.hibernate.MappingException: Unknown entity: java.lang.Integer

解决org.hibernate.MappingException: Unknown entity: java.lang.Integer

上一章章节目录 2018-08-19已有4465人阅读 评论(0)

org.hibernate.MappingException: Unknown entity: java.lang.Integer

解决方法:

问题出现在hibernate的get方法上,通过实体的id和类型获取对象,如果传进来的entityClass是Integer.class就会报错,因为数据库中没Integer表,项目的实体类中也没有Integer类。

sessionFactory.getCurrentSession().get(entityClass, id);

详情:


本文链接:http://www.yayihouse.com/yayishuwu/chapter/1501



向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交