Class JPQLQueryHelper

java.lang.Object
org.datanucleus.store.query.JPQLQueryHelper

public class JPQLQueryHelper extends Object
JPQL query helper class providing key information about the language etc.
  • Field Details

    • SINGLE_STRING_KEYWORDS

      static final String[] SINGLE_STRING_KEYWORDS
      Keywords used in single-string JPQL. Uppercase variants specified here, but JPQL allows case-insensitive.
    • SINGLE_STRING_KEYWORDS_INCLUDING_RANGE

      static final String[] SINGLE_STRING_KEYWORDS_INCLUDING_RANGE
      JPQL single-string keywords when allowing RANGE.
    • RESERVED_IDENTIFIERS

      static final String[] RESERVED_IDENTIFIERS
      List of identifier names not allowed by JPQL.
  • Constructor Details

    • JPQLQueryHelper

      public JPQLQueryHelper()
  • Method Details

    • isKeyword

      public static boolean isKeyword(String name)
      Convenience method returning if the supplied name is a keyword for this query language.
      Parameters:
      name - Name to check
      Returns:
      Whether it is a keyword
    • isKeyword

      public static boolean isKeyword(String name, boolean allowRange)
      Convenience method returning if the supplied name is a keyword for this query language (including RANGE).
      Parameters:
      name - Name to check
      allowRange - Whether to allow RANGE syntax
      Returns:
      Whether it is a keyword
    • isReservedIdentifier

      public static boolean isReservedIdentifier(String name)
      Convenience method returning if the supplied name is a reserved identifier for this query language.
      Parameters:
      name - Name to check
      Returns:
      Whether it is a reserved identifier
    • getEntityNameFromJPQLString

      public static String getEntityNameFromJPQLString(String query)
      Convenience method to extract the FROM candidate entity name from a JPQL query string.
      Parameters:
      query - The query string
      Returns:
      The candidate entity name
    • getJPQLForExpression

      public static String getJPQLForExpression(Expression expr)
      Convenience method to return the JPQL single-string query text for the provided expression.
      Parameters:
      expr - The expression
      Returns:
      The JPQL single-string text that equates to this expression