org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped [from user] at org.hibernat

代码:

EntityManager em = SpringBeanUtils.getBean(EntityManager.class);
Query query = em.createQuery("select id from user");
return query.getResultList();

解决:
HQL中的应写对应的类名,而不是数据库名

@Entity(name = "ormuser")
Query query = em.createQuery("select id from ormuser");
posted @ 2022-05-27 18:05  还可入梦  阅读(42)  评论(0编辑  收藏  举报