1 Reply Latest reply on Jan 14, 2011 3:16 AM by adamw

    Use Criteria for querying relations in audit entries

    robau

      Hi All,

       

      I use the Criteria API a lot to filter lists that are based on related objets and fields. I use a (recursive ) method to add criteria by LEFT JOIN. For example, I have a field "person.address.streetname=Oakstreet". My code automatically creates the Criteria by creating subcriteria. Here is a snippet

       

              if (fieldName.contains("."))

              {

                  String[] fieldNameValues = fieldName.split( "\\.", 2);

       

                  Criteria subquery;

                  String prefix = fieldNameValues[0];

                  subquery = criteria.createCriteria(prefix,Criteria.LEFT_JOIN);           
                  addCriterium( subquery, fieldNameValues[1], operator, value, sortCol, sortDir, critMap);
              }

       

      I want to achieve the same in my AuditQuery. But I cannot find a way to make sub-criteria. It there one? Or will this not be implemented in the near future?