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

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

解决方法:

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

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

posted @ 2022-04-14 10:49  塞纳纽斯  阅读(241)  评论(0)    收藏  举报