I am having one function which is trying to retrieve some data from database using hibernate. I am getting
org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped [FROM User where id = :id]
@Override
public List<User> getUserById(int id) {
System.out.println(id);
Query query = sessionFactory.getCurrentSession().createQuery("FROM User where id = :id");
query.setInteger("id", id);
return query.list();
}
The id is passing via URL and receiving it by a controller class which further calling my above function.
It seems that query is correct, not able to understand why getting this error.
Please provide your suggestion on same. Thanks in Advance.