Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.1.3
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
i am new to hibernate and trying to fetch data from tbl_user table.
My code the query way
tempUser = (User) session.createQuery("from User as usr where usr.userName like
'yog@abc.com'").uniqueResult();
My code the criteria way
Criteria criteria = getSession().createCriteria(getPersistentClass());
criteria.add(Restrictions.eq("userName", (String)user.getUserName()));
tempUser = (User)criteria.uniqueResult();
The SQL generated by Hibernate is:
Hibernate: select user0_.USER_ID as USER1_0_, user0_.userName as userName0_, user0_.password as password0_ from TBL_USER user0_ where user0_.userName like
'yog@abc.com'
This throws an error
The exception is : org.hibernate.exception.SQLGrammarException: could not execute query
Web Server: Tomcat
IDE:Eclipse 3.1
Could anyone help plz...