[Resolved] org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped

[Resolved] org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped

I got this exception org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped, because store is not my class name it should be Store (S – capital). When we are writing the HQL, it is mandatory to maintain the cases like how it is exactly.

I have provided the sample issue and resolved one for your quick reference.

Issue:

[java]

List results = (List) entityManager.createQuery(“from store s inner join coupon c where c.store_store_id = s.store_id”,Store.class);
System.out.println(results.size());

[/java]

 

Resolution:

[java]

List results = (List) entityManager.createQuery(“from Store s inner join Coupon c where c.store_store_id = s.store_id”,Store.class);
System.out.println(results.size());

[/java]

 

here s is an alias name we can mention either Store as s or Store s, because as is an optional

Leave a Reply