1 Reply Latest reply on Feb 13, 2008 2:44 PM by P Boevink

    Why a STATIC RESTRICTIONS in Seam-gen EntityQuery?

    P Boevink Newbie
      All sessionbean lists generated by seam-gen provide an implementation of an EntityQuery class.

      Why is the String[] of RESTRICTIONS marked as Static? as shown below:

      package web.session;

      import web.entity.user.*;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.framework.EntityQuery;
      import java.util.List;
      import java.util.Arrays;

      @Name("userList")
      public class UserList extends EntityQuery {

           private static final String[] RESTRICTIONS = {
                     "lower(email) like concat(lower(#{userList.user.email}),'%')",
                     "lower(password) like concat(lower(#{userList.user.password}),'%')",
                     "lower(username) like concat(lower(#{userList.user.username}),'%')", };

           private User user = new User();

           @Override
           public String getEjbql() {
                return "select user from User user";
           }

           @Override
           public Integer getMaxResults() {
                return 25;
           }

           public User getUser() {
                return user;
           }

           @Override
           public List<String> getRestrictions() {
                return Arrays.asList(RESTRICTIONS);
           }

      }
           


      The only place currently reffering to this attribute is within the class itself (getRestrictions).
      Or am I missing something?

      ``

      ``
        • 1. Re: Why a STATIC RESTRICTIONS in Seam-gen EntityQuery?
          P Boevink Newbie

          All sessionbean lists generated by seam-gen provide an implementation of an EntityQuery class.


          Why is the String[] of RESTRICTIONS marked as Static? as shown below:


          
          package web.session;
          
          
          import web.entity.user.*;
          
          import org.jboss.seam.annotations.Name;
          
          import org.jboss.seam.framework.EntityQuery;
          
          import java.util.List;
          
          import java.util.Arrays;
          
          
          @Name("userList")
          
          public class UserList extends EntityQuery {
          
          
               private static final String[] RESTRICTIONS = {
          
                         "lower(email) like concat(lower(#{userList.user.email}),'%')",
          
                         "lower(password) like concat(lower(#{userList.user.password}),'%')",
          
                         "lower(username) like concat(lower(#{userList.user.username}),'%')", };
          
          
               private User user = new User();
          
          
               @Override
          
               public String getEjbql() {
          
                    return "select user from User user";
          
               }
          
          
               @Override
          
               public Integer getMaxResults() {
          
                    return 25;
          
               }
          
          
               public User getUser() {
          
                    return user;
          
               }
          
          
               @Override
          
               public List<String> getRestrictions() {
          
                    return Arrays.asList(RESTRICTIONS);
          
               }
          
          
          }
          
          
          


          The only place currently reffering to this attribute is within the class itself (getRestrictions).
          Or am I missing something?