Class QueryHintsHandler

java.lang.Object
org.eclipse.persistence.internal.jpa.QueryHintsHandler

public class QueryHintsHandler extends Object
The class processes query hints. EclipseLink query hints and their values defined in org.eclipse.persistence.config package. To add a new query hint: Define a new hint in QueryHints; Add a class containing hint's values if required to config package (like CacheUsage); Alternatively values defined in HintValues may be used - Refresh and BindParameters hints do that. Add an inner class to this class extending Hint corresponding to the new hint (like CacheUsageHint); The first constructor parameter is hint name; the second is default value; In constructor provide 2-dimensional value array in case the values should be translated (currently all Hint classes do that); in case translation is not required provide a single-dimension array (no such examples yet). In inner class Hint static initializer addHint an instance of the new hint class (like addHint(new CacheUsageHint())).
See Also:
  • Field Details

  • Method Details

    • verify

      public static void verify(Map hints, String queryName, AbstractSession session)
      Verifies the hints. If session != null then logs a FINEST message for each hint. queryName parameter used only for identifying the query in messages, if it's null then "null" will be used. Throws IllegalArgumentException in case the hint value is illegal.
    • verify

      public static void verify(String hintName, Object hintValue, String queryName, AbstractSession session)
      Verifies the hint. If session != null then logs a FINEST message. queryName parameter used only for identifying the query in messages, if it's null then "null" will be used. Throws IllegalArgumentException in case the hint value is illegal.
    • apply

      public static DatabaseQuery apply(Map<String,Object> hints, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession)
      Applies the hints to the query. Throws IllegalArgumentException in case the hint value is illegal.
    • apply

      public static DatabaseQuery apply(String hintName, Object hintValue, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession)
      Applies the hint to the query. Throws IllegalArgumentException in case the hint value is illegal.
    • parseBooleanHint

      public static boolean parseBooleanHint(Object hint)
      Common hint value processing into an boolean value. If the hint is null, false is returned. Those methods that need to handle a null hint to be something other than false should not call this method.
    • parseIntegerHint

      public static int parseIntegerHint(Object hint, String hintName)
      Common hint value processing into an integer value. If the hint is null, -1 is returned.
    • shouldUseDefault

      protected static boolean shouldUseDefault(Object hintValue)
      Empty String hintValue indicates that the default hint value should be used.
    • getSupportedHints

      public static Set<String> getSupportedHints()