[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:


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());

 

Resolution:


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());

 

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

181 total views, 3 views today

Leave a Reply

Your email address will not be published. Required fields are marked *