In the HQL , you should use the java class name and property name of the mapped @Entity
instead of the actual table name and column name , so the HQL should be :
List<User> result = session.createQuery("from User", User.class).getResultList();
Update : To be more precise , you should use the entity name configured in @Entity
to refer to the “table” , which default to unqualified name of the mapped java class if you do not set it explicitly.
(P.S. It is @javax.persistence.Entity
but not @org.hibernate.annotations.Entity
)