Hi All, Been trying to figure this for a few days now, I must be missing something on the config side of things. Im using netbeans to create a simple login form which looks at a MySQL table Users. I followed the tutorial on the netbeans website to create the Hibernate config file, reverse engineer, pojos and mapping files, etc. Im having a problem that when i try to run HQL it fails with a syntax error: ------------------------ javax.servlet.ServletException: org.hibernate.exception.SQLGrammarException: could not execute query ------------------------ com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from Users' at line 1 ------------------------
the code i am tying to run is a simple from command : org.hibernate.Query query = session.createSQLQuery("from Users'"); userList = (List<Users>) query.list();
This works if I change to sql statement to "Select * From Users", but it will not recognise it as a list of Users. It seems to me like it can recognise SQL but not HQL.
Any help would be greatly appreciated
Alex
|