org.hibernate.hql.internal.ast.QuerySyntaxException: table is not mapped

in HQL query, Don't write the Table name, write your Entity class name in your query like

String s = "from Entity_class name";
query qry = session.createUqery(s);

Finally I found a mistake! Hope this is useful to someone. When doing a request to the database(in my case it Apache Derby), name of base need write the first letter upper case other in lower case.

This is wrong query:

session.createQuery("select first_name from CUSTOMERV").

This is valid query

session.createQuery("select first_name from Customerv"). 

And class entity must be same name as database, but I'm not sure.


In my case I just forgot to add nativeQuery = true

@Query( value = "some sql query ...", nativeQuery = true)

For Spring Boot with Spring Data JPA