7 Replies Latest reply on Oct 26, 2007 1:10 PM by Pete Muir

    EntityQuery Restrictions

    Michael Griffith Newbie

      Hello All,

      I have some components generated by seamgen, specifically the EntityQuery Lists that relate to a list of entity objects. The seam generated search form allows the restrictions to be passed to the query:

      public class StatusList extends EntityQuery {
      
       private static final String[] RESTRICTIONS = {"lower(status.description) like concat('%', concat(lower(#{statusList.status.description}),'%'))",};
      ...
       private Status status = new Status();
      
       @Override
       public String getEjbql() {
       return "select status from Status status order by status.sortOrder";
       }
      ...

      The query works well if no parameters are passed to the restrictions, the list is returned in the correct order, however if I pass a parameter to the restrictions clause the predicates of where/order are mixed up and invalid SQL is executed, which of course produces an error.

      What is the correct way to approach this?

      Thanks in advance!
      MG