2 Replies Latest reply on Oct 21, 2012 11:09 AM by su baochen

    Question about EntityQuery and multiple tables

    leor amikam Newbie

      Hello, I am a Seam and HQL/EJBQL newbie.  I need to add some constraints to an EntityQuery's restrictions, that joins with another table.  Here are the basics:


      public class UcbsvcoList extends EntityQuery<MyClass>


      private static final String EJBQL = "select ucbsvco from Ucbsvco ucbsvco";


      private static final String[] RESTRICTIONS = {
         "lower(ucbsvco.ucbsvcoSrceCode) like lower(#{ucbsvcoList.ucbsvco.ucbsvcoSrceCode})",
         "lower(ucbsvco.ucbsvcoSotpCode) like lower(#{ucbsvcoList.ucbsvco.ucbsvcoSotpCode})",
          ... more restrictions....


      Here is the query I need to execute:

      SELECT ucbsvco.*
        FROM ucbsvco, ucrevnt
      WHERE    <whatever restriction is used>
         AND  ucbsvco_code = ucrevnt_svco_code
                AND ucrevnt_nmac_ind = 'N'


      How do I override the SQL creation to add this?