My Code: Query query = ebeanServer.createNamedQuery(Log4jEdi.class,"Log4jEdi.findByLogLevel"); query.setParameter("logLevel","ERROR");
List list = query .findList(); System.out.println(list);=========================================================NamedQuery:@Entity@Table(name = "LOG4J_EDI")@NamedQueries( { @NamedQuery(name = "Log4jEdi.findAll", query = "SELECT l FROM Log4jEdi l"), @NamedQuery(name = "Log4jEdi.findByLogId", query = "SELECT l FROM Log4jEdi l WHERE l.logId = :logId"), @NamedQuery(name = "Log4jEdi.findByLogDate", query = "SELECT l FROM Log4jEdi l WHERE l.logDate = :logDate"), @NamedQuery(name = "Log4jEdi.findByLogLevel", query = "SELECT l FROM Log4jEdi l WHERE l.logLevel = :logLevel"), @NamedQuery(name = "Log4jEdi.findByLogThread", query = "SELECT l FROM Log4jEdi l WHERE l.logThread = :logThread"), @NamedQuery(name = "Log4jEdi.findByLogClassname", query = "SELECT l FROM Log4jEdi l WHERE l.logClassname = :logClassname") })=========================================================Exception:javax.persistence.PersistenceException: Query expected 'join', 'where','order by' or 'limit' keyword but got [SELECT] SELECT l FROM Log4jEdi l WHERE l.logLevel = :logLevel at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.process(OrmQueryDetailParser.java:67) at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.processInitial(OrmQueryDetailParser.java:45) at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.parse(OrmQueryDetailParser.java:29) at com.avaje.ebean.server.querydefn.DefaultOrmQuery.setQuery(DefaultOrmQuery.java:603) at com.avaje.ebean.server.querydefn.DefaultOrmQuery.(DefaultOrmQuery.java:217) at com.avaje.ebean.server.core.DefaultServer.createNamedQuery(DefaultServer.java:962) at wjw.ebean.test.TestB.findUseNamedQuery(TestB.java:83) at wjw.ebean.test.TestB.main(TestB.java:123)
This is interesting because the Ebean query language intentionally uses FIND and not SELECT so that it can later support JPA's Query Language.
In Ebean's query language instead of:"SELECT l FROM Log4jEdi l WHERE l.logLevel = :logLevel"
You would have"WHERE logLevel = :logLevel"
Hmmm.
We could look to support simple JPA queries (like the ones you have above) but at this stage I'm not sure how much of the JPA Query language Ebean should support.
That is, a major issue I see with JPQL is the SELECT clause (and the JOIN's also have a different approach). I don't want to give the impression Ebean will fully support JPQL in it's current form because it may never do so.
If you need partial support for JPA ... let me know.
So closing this for now, thanks.