Suppose I have persistent object named 'User' mapped to Database table 'USER_DETAILS' in my User.hbm.xml file. When I tried to get object through HQL query ie
User user = session.createQuery("from User_Details where User_Id=1 ).uniqueResult();
I got " org.hibernate.hql.ast.QuerySyntaxExcepti
Solution : I found that in HQL we have to supply persistent Object class name instead of DB table name in queries to retrieve object. i.e.
User user = session.createQuery("from User where User_Id=1 ).uniqueResult();
Regards
Mohit Agrawal
2 comments:
Thnx,it is very helpful to me.
Hi,
Great info. I like all your post. I will keep visiting this blog very often. It is good to see you verbalize from the heart and your clarity on this important subject can be easily observed.
Authentication Certificate
Post a Comment