OK - first off - I've just started using Hibernate. So I apologize for such a simple question :)
Im trying to do a really simple query using HQL. Here's what the code looks like:
Code:
Query query = session.createQuery("from users where users.username=:username and users.password=:password");
query.setString("username", "admin");
query.setString("password", "password");
But when I run this it seems as though the dialect isnt turning this into a real SQL query.. it just seems to be passing it straight through to the database. I'm using MySQL as the database and setting the dialect to "net.sf.hibernate.dialect.MySQLDialect".
I'm getting this exception:
Code:
java.sql.SQLException: Syntax error or access violation, message from server: "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 where (users.username='admin' )and(users.password='password' )' at line 1"
My database name is "users" and my mapped object is User. Should they, or are they required to have the same name?