org.hibernate.hql.ast.QuerySyntaxException: Class-name is not mapped

In this post i will guide you through how to solve below hibernate exception when using HQL

org.hibernate.hql.internal.ast.QuerySyntaxException: Class-name is not mapped

In my experience has many reasons for that exception. I will guide you step by step to check the issue

1. Check your hibernate config file hibernate.cgf.xml, do you have define that class yet or not in that file.  If you already define please go to next step

2. If you using hibernate mapping file, please naming for that file same as Class name.

3. If your persistence class define with annotation @Entity(name=’entity_name’) so please use that in HQL in case that you use unqualified name for example if your class is SystemParameter but you annotation @Entity(name=’param’) please use param name. Cause hibernate will use this alias name instead of class name.

4. If all above not work for you so please use full qualified name for example com.devjav.SystemParameter instead SystemParameter

Leave a Reply