Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    Hello, any news about this issue?

    Comment


      #17
      Hi Claudio, sorry for the delay on this one. Refactoring to introduce a major new feature (AdvancedCriteria subqueries) broke this particular interaction.

      In tomorrow's builds (11/15 and later) you should find this fixed.

      Comment


        #18
        SmartClient Version: v13.1p_2024-11-16/Enterprise Deployment (built 2024-11-16)

        I see it's fixed, thank you very much.

        Comment


          #19
          SmartClient Version: v13.1p_2025-08-30/Enterprise Deployment (built 2025-08-30)

          Hello, there’s a regression in the 13.1 build.
          The bug related to customCriteriaFields being ignored (mentioned in post #13, and fixed in build v13.1p_2024-11-16) has reappeared.
          The last working build is v13.1p_2025-06-11, while v13.1p_2025-06-12 no longer works.
          Last edited by claudiobosticco; 1 Sep 2025, 04:52. Reason: edited for clarity

          Comment


            #20

            Thanks for the report. We’ve re-checked both the builds you mentioned and the latest 13.1p (2025-09-02), but haven’t been able to reproduce the regression — customCriteriaFields are working as expected here.

            Since you mentioned the symptoms match the earlier issue from post #13, could you provide reproducible details for the current case so we can confirm we’re looking at the same problem?

            Comment


              #21
              Hi, after a closer analysis, I see that this is not the same error as before.

              This time, the error is related to the fact that the criteria for the customCriteriaFields are being added in a DMI using dsRequest.addToCriteria().

              By doing so, I get the following WARN for the customCriteriaField:
              Code:
              WARN SQLExpressions Missing expression for the 'ID_ROLE_FK' field of the 'AUTH_MENU_ROLES_PERMISSIONS' DataSource.
              and in the WHERE clause I only see '1'='1'.

              I tried sending, from the client, a criteria for one of those customCriteriaFields, and in that case I don’t see the WARN, and in the WHERE clause I can see both the client-sent criteria and the server-added one.

              Before putting effort into creating a test case, I’d like to be sure that I’m not doing something unsupported by adding a criteria on customCriteriaFields in the DMI.

              Is this a supported approach, or should I be using a different method?
              Last edited by claudiobosticco; 4 Sep 2025, 12:02.

              Comment


                #22
                Thanks for the clarification. Adding criteria for customCriteriaFields in a DMI via dsRequest.addToCriteria() is a supported approach and should work.

                We’ve specifically retested this scenario in the latest 13.1 build — both with initial client-sent criteria and with none (so the DMI adds the only criteria) — and in all cases the criteria were applied as expected with no warnings.

                Please share a minimal test case so we can investigate.

                Comment


                  #23
                  SmartClient Version: v13.1p_2025-09-09/Enterprise Deployment (built 2025-09-09)

                  Hi, this turned out to be trickier than I first thought.
                  The problem is triggered by a fetch using an AdvancedCriteria:

                  Code:
                  AUTH_MENU_ROLES_PERMISSIONS.fetchData({
                          operator:"and",
                          criteria:[
                              {
                                  fieldName:"ID_APP",
                                  operator:"equals",
                                  value:"JcaAuth"
                              }
                          ]
                      })
                  However, it works if I use a simple criteria:
                  Code:
                  AUTH_MENU_ROLES_PERMISSIONS.fetchData({ID_APP: "JcaAuth"})
                  Here are the dataSources:
                  Code:
                  <DataSource xmlns:fmt="WEB-INF/" xmlns="http://www.smartclient.com/schema"
                              ID="AUTH_MENU_ROLES_PERMISSIONS"
                              dataFormat="iscServer"
                              serverType="sql"
                              dbName="dbJFrame"
                              schema="DBJFRAME"
                              tableName="TREE_MENU"
                              dropExtraFields="false"
                              useAnsiJoins="true"
                  >
                      <fields>
                          <field name="ID_REC" primaryKey="true" type="sequence" sequenceName="SEQUENCE_REC"/>
                          <field name="ID_APP" type="text" required="true" length="20"/>
                          <field name="ID_ROLE_FK" type="integer" customSelectExpression="MENU_ROLES.ID_ROLE_FK" customSQL="true"/>
                          <field name="ID_ROLES" type="text" customSelectExpression="MENU_ROLES.ID_ROLE_FK" customSQL="true"/>
                      </fields>
                      <operationBindings>
                          <operationBinding operationType="fetch"
                                            customCriteriaFields="ID_ROLE_FK">
                              <scriptImport>com.isomorphic.criteria.*</scriptImport>
                              <scriptImport>com.isomorphic.criteria.criterion.*</scriptImport>
                              <script language="groovy">
                                  dsRequest.addToCriteria(
                                      new AdvancedCriteria(DefaultOperators.Or,
                                              new SetCriterion("ID_PERMISSION_FK", DefaultOperators.InSet, DataTools.buildList(3, 4)),
                                              new SetCriterion("ID_ROLE_FK", DefaultOperators.InSet, DataTools.buildList(1, 2))
                                      )
                                  );
                                  return dsRequest.execute();
                              </script>
                              <tableClause>
                                  $defaultTableClause
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                              </tableClause>
                              <summaryFunctions>
                                  <ID_ROLES>concat</ID_ROLES>
                              </summaryFunctions>
                          </operationBinding>
                      </operationBindings>
                  </DataSource>
                  
                  <DataSource xmlns:fmt="WEB-INF/" xmlns="http://www.smartclient.com/schema"
                              ID="AUTH_MENU_ROLES"
                              serverType="sql"
                              dbName="dbJFrame"
                              schema="DBJFRAME"
                              tableName="AUTH_MENU_ROLES"
                              allowAdvancedCriteria="true"
                              useAnsiJoins="true"
                              dropExtraFields="false"
                  >
                      <fields>
                          <field name="ID_REC" primaryKey="true" type="sequence" hidden="true" sequenceName="SEQUENCE_AUTH"/>
                          <field name="ID_MENU_FK" type="integer" foreignKey="TREE_MENU.ID_REC" relatedTableAlias="MENU" required="true"/>
                          <field name="ID_ROLE_FK" type="integer" foreignKey="AUTH_ROLES.ID_REC" relatedTableAlias="ROLES" required="true"/>
                      </fields>
                  </DataSource>
                  
                  <DataSource xmlns:fmt="WEB-INF/" xmlns="http://www.smartclient.com/schema"
                              ID="AUTH_ROLES"
                              serverType="sql"
                              dbName="dbJFrame"
                              schema="DBJFRAME"
                              tableName="AUTH_ROLES"
                              allowAdvancedCriteria="true"
                              useAnsiJoins="true"
                              dropExtraFields="false"
                  >
                      <fields>
                          <field name="ID_REC" primaryKey="true" type="sequence" hidden="true" sequenceName="SEQUENCE_AUTH"/>
                          <field name="ROLE" type="trimText" length="200" required="true"/>
                      </fields>
                  </DataSource>
                  Note that in the server script there’s a SetCriterion for ID_PERMISSION_FK, which was present in the real use case. It also had fields, joins, and summary functions similar to ID_ROLE_FK and ID_ROLES.
                  I removed them to simplify the test case, since I saw the issue was still there without them (anyway I’ll also include the dataSource including them at the bottom of the post).
                  But in the end, I noticed that if I remove that criterion, it works.

                  In the log produced by the fetch with the AdvancedCriteria, you can see that the criterion for ID_ROLE_FK is missing:

                  Code:
                  DEBUG RPCManager Starting request parsing
                  DEBUG RPCManager Done request parsing
                  DEBUG RPCManager Processing 1 requests.
                  DEBUG RPCManager Request #1 (DSRequest) payload: {
                      criteria:{
                          _constructor:"AdvancedCriteria",
                          operator:"and",
                          criteria:[
                              {
                                  fieldName:"ID_APP",
                                  operator:"equals",
                                  value:"JcaAuth"
                              }
                          ]
                      },
                      operationConfig:{
                          dataSource:"AUTH_MENU_ROLES_PERMISSIONS",
                          repo:null,
                          operationType:"fetch",
                          textMatchStyle:"exact"
                      },
                      appID:"builtinApplication",
                      operation:"AUTH_MENU_ROLES_PERMISSIONS_fetch",
                      oldValues:{
                          _constructor:"AdvancedCriteria",
                          operator:"and",
                          criteria:[
                              {
                                  fieldName:"ID_APP",
                                  operator:"equals",
                                  value:"JcaAuth"
                              }
                          ]
                      },
                      tenantId:null
                  }
                  INFO IDACall Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36]
                  INFO DSRequest Executing AUTH_MENU_ROLES_PERMISSIONS.fetch rows: 0->-1 with
                  criteria: {
                      _constructor:"AdvancedCriteria",
                      operator:"and",
                      criteria:[
                          {fieldName:"ID_APP", operator:"equals", value:"JcaAuth"}
                      ]
                  }
                  DEBUG PoolableSQLConnectionFactory Executing pingTest 'select 1 from dual' on connection 1415690804
                  DEBUG SQLConnectionManager Borrowed connection '1415690804' from DBCP
                  DEBUG SQLTransaction Started new dbJFrame transaction "1415690804"
                  INFO DSRequest Executing AUTH_MENU_ROLES_PERMISSIONS.fetch rows: 0->-1 with
                  criteria: {
                      _constructor:"AdvancedCriteria",
                      criteria:[
                          {fieldName:"ID_APP", __normalized:true, value:"JcaAuth", operator:"equals"},
                          {
                              _constructor:"AdvancedCriteria",
                              criteria:[
                                  {
                                      fieldName:"ID_PERMISSION_FK",
                                      value:[3, 4],
                                      operator:"inSet"
                                  },
                                  {
                                      fieldName:"ID_ROLE_FK",
                                      value:[1, 2],
                                      operator:"inSet"
                                  }
                              ],
                              __normalized:true,
                              operator:"or"
                          }
                      ],
                      __normalized:true,
                      operator:"and"
                  }
                  DEBUG AppBase No userTypes defined, allowing anyone access to all operations for this application
                  DEBUG AppBase No public zero-argument method named '_AUTH_MENU_ROLES_PERMISSIONS_fetch' found, performing generic datasource operation
                  WARN SQLSelectClause SQLSelectClause is null or zero size, remap and conversions won't work!
                  DEBUG SQLOrderClause no data; returning empty string
                  WARN SQLExpressions Missing expression for the 'ID_PERMISSION_FK' field of the 'AUTH_MENU_ROLES_PERMISSIONS' DataSource.
                  WARN SQLExpressions Missing expression for the 'ID_ROLE_FK' field of the 'AUTH_MENU_ROLES_PERMISSIONS' DataSource.
                  INFO SQLWhereClause empty condition
                  INFO SQLDataSource derived query: SELECT $defaultSelectClause FROM
                                  $defaultTableClause
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE $defaultWhereClause HAVING (('1'='1'))
                  DEBUG SQL 625: Executing SQL query on 'dbJFrame': SELECT * FROM
                                  DBJFRAME.TREE_MENU
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE ((TREE_MENU.ID_APP = 'JcaAuth' AND TREE_MENU.ID_APP IS NOT NULL) AND (('1'='1') OR ('1'='1'))) HAVING (('1'='1'))
                  INFO SQL Executing SQL query on 'dbJFrame': SELECT * FROM
                                  DBJFRAME.TREE_MENU
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE ((TREE_MENU.ID_APP = 'JcaAuth' AND TREE_MENU.ID_APP IS NOT NULL) AND (('1'='1') OR ('1'='1'))) HAVING (('1'='1'))
                  INFO DSResponse DSResponse: List with 17 items
                  INFO DSResponse DSResponse: List with 17 items
                  DEBUG RPCManager Content type for RPC transaction: text/plain; charset=UTF-8
                  DEBUG SQLTransaction Committing dbJFrame transaction "1415690804"
                  DEBUG RPCManager DMI response, dropExtraFields: false
                  DEBUG SQLTransaction getConnection() looked for transactional connection for dbJFrame: hashcode "1415690804"
                  DEBUG SQLTransaction Ending dbJFrame transaction "1415690804"
                  DEBUG SQLConnectionManager About to close connection with hashcode "1415690804"
                  DEBUG PoolableSQLConnectionFactory Executing pingTest 'select 1 from dual' on connection 1415690804
                  While with the simple criteria it is present:

                  Code:
                  DEBUG RPCManager Starting request parsing
                  DEBUG RPCManager Done request parsing
                  DEBUG RPCManager Processing 1 requests.
                  DEBUG RPCManager Request #1 (DSRequest) payload: {
                      criteria:{
                          ID_APP:"JcaAuth"
                      },
                      operationConfig:{
                          dataSource:"AUTH_MENU_ROLES_PERMISSIONS",
                          repo:null,
                          operationType:"fetch",
                          textMatchStyle:"exact"
                      },
                      appID:"builtinApplication",
                      operation:"AUTH_MENU_ROLES_PERMISSIONS_fetch",
                      oldValues:{
                          ID_APP:"JcaAuth"
                      },
                      tenantId:null
                  }
                  INFO IDACall Performing 1 operation(s) [UA: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36]
                  INFO DSRequest Executing AUTH_MENU_ROLES_PERMISSIONS.fetch rows: 0->-1 with
                  criteria: {ID_APP:"JcaAuth"}
                  DEBUG PoolableSQLConnectionFactory Executing pingTest 'select 1 from dual' on connection 520471221
                  DEBUG SQLConnectionManager Borrowed connection '520471221' from DBCP
                  DEBUG SQLTransaction Started new dbJFrame transaction "520471221"
                  INFO DSRequest Executing AUTH_MENU_ROLES_PERMISSIONS.fetch rows: 0->-1 with
                  criteria: {
                      _constructor:"AdvancedCriteria",
                      criteria:[
                          {fieldName:"ID_APP", value:"JcaAuth", operator:"iEquals"},
                          {
                              criteria:[
                                  {
                                      fieldName:"ID_PERMISSION_FK",
                                      value:[3, 4],
                                      operator:"inSet"
                                  },
                                  {
                                      fieldName:"ID_ROLE_FK",
                                      value:[1, 2],
                                      operator:"inSet"
                                  }
                              ],
                              operator:"or"
                          }
                      ],
                      operator:"and"
                  }
                  DEBUG AppBase No userTypes defined, allowing anyone access to all operations for this application
                  DEBUG AppBase No public zero-argument method named '_AUTH_MENU_ROLES_PERMISSIONS_fetch' found, performing generic datasource operation
                  WARN SQLSelectClause SQLSelectClause is null or zero size, remap and conversions won't work!
                  DEBUG SQLOrderClause no data; returning empty string
                  WARN SQLExpressions Missing expression for the 'ID_PERMISSION_FK' field of the 'AUTH_MENU_ROLES_PERMISSIONS' DataSource.
                  INFO SQLWhereClause empty condition
                  INFO SQLDataSource derived query: SELECT $defaultSelectClause FROM
                                  $defaultTableClause
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE $defaultWhereClause HAVING (('1'='1'))
                  DEBUG SQL 625: Executing SQL query on 'dbJFrame': SELECT * FROM
                                  DBJFRAME.TREE_MENU
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE ((LOWER(TREE_MENU.ID_APP)=LOWER('jcaauth') AND TREE_MENU.ID_APP IS NOT NULL) AND (('1'='1') OR ((MENU_ROLES.ID_ROLE_FK IN (1, 2)) AND MENU_ROLES.ID_ROLE_FK IS NOT NULL))) HAVING (('1'='1'))
                  INFO SQL Executing SQL query on 'dbJFrame': SELECT * FROM
                                  DBJFRAME.TREE_MENU
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                               WHERE ((LOWER(TREE_MENU.ID_APP)=LOWER('jcaauth') AND TREE_MENU.ID_APP IS NOT NULL) AND (('1'='1') OR ((MENU_ROLES.ID_ROLE_FK IN (1, 2)) AND MENU_ROLES.ID_ROLE_FK IS NOT NULL))) HAVING (('1'='1'))
                  INFO DSResponse DSResponse: List with 17 items
                  INFO DSResponse DSResponse: List with 17 items
                  DEBUG RPCManager Content type for RPC transaction: text/plain; charset=UTF-8
                  DEBUG SQLTransaction Committing dbJFrame transaction "520471221"
                  DEBUG RPCManager DMI response, dropExtraFields: false
                  DEBUG SQLTransaction getConnection() looked for transactional connection for dbJFrame: hashcode "520471221"
                  DEBUG SQLTransaction Ending dbJFrame transaction "520471221"
                  DEBUG SQLConnectionManager About to close connection with hashcode "520471221"
                  DEBUG PoolableSQLConnectionFactory Executing pingTest 'select 1 from dual' on connection 520471221
                  If you prefer (or need it), here’s the dataSource with both customCriteriaFields:

                  Code:
                  <DataSource xmlns:fmt="WEB-INF/" xmlns="http://www.smartclient.com/schema"
                              ID="AUTH_MENU_ROLES_PERMISSIONS"
                              dataFormat="iscServer"
                              serverType="sql"
                              dbName="dbJFrame"
                              schema="DBJFRAME"
                              tableName="TREE_MENU"
                              dropExtraFields="false"
                              useAnsiJoins="true"
                  >
                      <fields>
                          <field name="ID_REC" primaryKey="true" type="sequence" sequenceName="SEQUENCE_REC"/>
                          <field name="ID_APP" type="text" required="true" length="20"/>
                          <field name="ID_ROLE_FK" type="integer" customSelectExpression="MENU_ROLES.ID_ROLE_FK" customSQL="true"/>
                          <field name="ID_ROLES" type="text" customSelectExpression="MENU_ROLES.ID_ROLE_FK" customSQL="true"/>
                          <field name="ID_PERMISSION_FK" type="integer" customSelectExpression="MENU_PERMISSIONS.ID_PERMISSION_FK" customSQL="true"/>
                          <field name="ID_PERMISSIONS" type="integer" customSelectExpression="MENU_PERMISSIONS.ID_PERMISSION_FK" customSQL="true"/>
                      </fields>
                      <operationBindings>
                          <operationBinding operationType="fetch"
                                            customCriteriaFields="ID_ROLE_FK,ID_PERMISSION_FK">
                              <scriptImport>com.isomorphic.criteria.*</scriptImport>
                              <scriptImport>com.isomorphic.criteria.criterion.*</scriptImport>
                              <script language="groovy">
                                  dsRequest.addToCriteria(
                                      new AdvancedCriteria(DefaultOperators.Or,
                                              new SetCriterion("ID_PERMISSION_FK", DefaultOperators.InSet, DataTools.buildList(3, 4)),
                                              new SetCriterion("ID_ROLE_FK", DefaultOperators.InSet, DataTools.buildList(1, 2))
                                      )
                                  );
                                  return dsRequest.execute();
                              </script>
                              <tableClause>
                                  $defaultTableClause
                                  LEFT JOIN DBJFRAME.AUTH_MENU_ROLES MENU_ROLES ON TREE_MENU.ID_REC = MENU_ROLES.ID_MENU_FK
                                  LEFT JOIN DBJFRAME.AUTH_ROLES ROLES ON MENU_ROLES.ID_ROLE_FK = ROLES.ID_REC
                                  LEFT JOIN DBJFRAME.AUTH_MENU_PERMISSIONS MENU_PERMISSIONS ON TREE_MENU.ID_REC = MENU_PERMISSIONS.ID_MENU_FK
                                    LEFT JOIN DBJFRAME.AUTH_PERMISSIONS PERMISSIONS ON MENU_PERMISSIONS.ID_PERMISSION_FK = PERMISSIONS.ID_REC
                              </tableClause>
                              <summaryFunctions>
                                  <ID_ROLES>concat</ID_ROLES>
                                  <ID_PERMISSIONS>concat</ID_PERMISSIONS>
                              </summaryFunctions>
                          </operationBinding>
                      </operationBindings>
                  </DataSource>
                  This gives the same result: with a simple criteria I see both customCriteriaFields in the where clause, while with an AdvancedCriteria both are omitted.

                  Comment


                    #24
                    I forgot to confirm that this test case works with build v13.1p_2025-06-11, while it doesn’t work with v13.1p_2025-06-12 (when using an AdvancedCriteria).

                    Comment

                    Working...
                    X