[jboss-user] [JBoss Seam] - Re: EntityQuery bug

pete.muir@jboss.org do-not-reply at jboss.com
Fri Sep 28 09:16:20 EDT 2007


For the second issue (JBSEAM-1916) you should do something like this

@Name("mdrCases")
  | public class MdrCasesQuery extends EntityQuery {
  | 
  |    private boolean allCases;
  | 
  |    public void executeSearch() {
  |       String ejbql = "from MdrCase c".concat(allCases? "": " where (c.endingTreatmentDate is null)");
  |       super.setEjbql(ejbql);
  |    }
  | }

<h:commandButton action="#{mdrCases.executeSearch}" value="Search" />

Why? Well parsing the ejbql is a reasonably expensive operation so to save some cycles you have to explicitly tell the Query that the ejbql has changed.  This reserves the refresh method for updating the result based on changed restrictions/changed data.

I'm going to document this.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089689#4089689

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089689



More information about the jboss-user mailing list