mysql - Using JPA1.0: How to write queries -
good day,
i have weird problem:
this following statement works
query q = em.createquery("select m accountclass m");
whereas following statement not
query q = em.createquery("select m accountclass");
i'm trying write statement allows me use clause;
thank reading this.
em.createquery
expects jpql query , not sql query passed parameter.
select m accountclass
not valid jpql query, select m accountclass m
valid. if wish learn further jpql, can start java ee tutorial chapter on jpql.
the reason why select m accountclass m
works in case, because as
optional keyword. if wish issue clause, trivial - select m accountclass m m.x= :param1
, x
attribute of accountclass
class , param1
named parameter value has set using query.setparameter
method.
Comments
Post a Comment