Hello !
I have a query builded with EntityManager
:
Query q = em
.createQuery("SELECT * FROM :table WHERE username = :username AND password = MD5(:password)")
.setParameter("table", User.class.getName())
.setParameter("username", txtLogin.getText())
.setParameter("password", passPassword.getPassword())
;
User user = (User) q.getSingleResult();
but I get an exception:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT * FROM :table WHERE username = :username AND password = MD5(:password)], line 1, column 7: unexpected token [*].
How to fix it ?
Is it impossible to use *
in queries ?