Good day,
I have this weird problem:
This following statement works
Query q = em.createQuery("SELECT m from AccountClass as m");
whereas this following statement does not
Query q = em.createQuery("SELECT m from AccountClass");
I'm trying to write a statement that allows me to use the where clause;
thank you for reading this.
 
                        
em.createQueryexpects a JPQL query and not a SQL query to be passed as a parameter.SELECT m FROM AccountClassis not a valid JPQL query, where asSELECT m FROM AccountClass mis valid. If you wish to learn further about JPQL, you can start with the Java EE tutorial chapter on JPQL.The reason why
SELECT m FROM AccountClass as mworks in this case, is becauseASis an optional keyword. If you wish to issue a WHERE clause, it is trivial to do so -SELECT m FROM AccountClass m WHERE m.x= :param1, wherexis an attribute of theAccountClassclass andparam1is a named parameter whose value has to be set using theQuery.setParametermethod.