Module org.eclipse.persistence.jpa
Class QueryHintsHandler
java.lang.Object
org.eclipse.persistence.internal.jpa.QueryHintsHandler
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classConfigure the cache usage of the query.protected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classConfigure the cache usage of the query.protected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classDefine a generic Hint.protected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classINTERNAL: 325167: Make reserved # bind parameter char generic to enable native SQL pass throughprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classDefine the query cache expiry hint.protected static classDefine the query cache expiry time of day hint.protected static classDefine the query cache hint.protected static classDefine the query cache ignore null hint.protected static classDefine the query cache ignore null hint.protected static classDefine the query cache randomized expiry hint.protected static classDefine the query cache size hint.protected static classDefine the query cache type hint.protected static classprotected static classprotected static classprotected static classConfigure the type of the query.protected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classprotected static classThis hint can be used to indicate whether or not a ResultSetMapping query should return populated DatabaseRecords vs.protected static classprotected static class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseQueryapply(String hintName, Object hintValue, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) Applies the hint to the query.static DatabaseQueryapply(Map<String, Object> hints, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) Applies the hints to the query.static booleanparseBooleanHint(Object hint) Common hint value processing into an boolean value.static intparseIntegerHint(Object hint, String hintName) Common hint value processing into an integer value.protected static booleanshouldUseDefault(Object hintValue) Empty String hintValue indicates that the default hint value should be used.static voidverify(String hintName, Object hintValue, String queryName, AbstractSession session) Verifies the hint.static voidverify(Map hints, String queryName, AbstractSession session) Verifies the hints.
-
Field Details
-
QUERY_HINT_PROPERTY
- See Also:
-
-
Method Details
-
verify
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
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
Common hint value processing into an integer value. If the hint is null, -1 is returned. -
shouldUseDefault
Empty String hintValue indicates that the default hint value should be used. -
getSupportedHints
-