Class QueryTranslatorUtils

java.lang.Object
com.avoka.core.cayenne.QueryTranslatorUtils

public class QueryTranslatorUtils extends Object
Provides utility methods for Cayenne SelectQuery translators.
Since:
19.5.0
  • Constructor Details

    • QueryTranslatorUtils

      public QueryTranslatorUtils()
  • Method Details

    • addCountTranslation

      public static String addCountTranslation(String sql, String pkColumnName)
      Translate a plain SELECT query string into a SELECT COUNT DISTINCT query returning a number (the count).
      Parameters:
      sql - the query string (required, must not already be a SELECT COUNT query)
      pkColumnName - the name of the Cayenne primary column that will be used for counting results (required; can be obtained via CayenneUtils.getPkName(ObjEntity)
      Returns:
      the modified SQL string