Hibernate error - QuerySyntaxException: users is not mapped [from users]

前端 未结 19 2291
感动是毒
感动是毒 2020-11-30 20:14

I\'m trying to get a list of all the users from \"users\" table and I get the following error:

org.hibernate.hql.internal.ast.QuerySyntaxException: users is          


        
19条回答
  •  广开言路
    2020-11-30 21:07

    Just to share my finding. I still got the same error even if the query was targeting the correct class name. Later on I realised that I was importing the Entity class from the wrong package.

    The problem was solved after I change the import line from:

    import org.hibernate.annotations.Entity;
    

    to

    import javax.persistence.Entity;
    

提交回复
热议问题