问题
Are there JPA - vendor neutral - query hints that can be used ? During my google searches on query hints every mention of it has been a vendor specific query hint.
From the doc:
Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by the provider. Vendor-specific hints that are not recognized by a provider must be silently ignored. Portable applications should not rely on the standard timeout hint. Depending on the database in use and the locking mechanisms used by the provider, this hint may or may not be observed.
I'm not sure I'm understanding this correctly. Does this mean that there are vendor neutral query hints or there are not ? If so where can I find a list describing those ?
回答1:
According to the article found on Eclipse's website (http://www.eclipse.org/eclipselink/documentation/2.6/concepts/queries006.htm) query hints are vendor specific.
Eclipse states that: "The definitions of query hints are vendor-specific. The following sections describe JPA query hints and EclipseLink query hints"
The article continues with specific implementation details for the two types of query hints (JPA and EclipseLink).
Further research on Apache's website (http://openjpa.apache.org/builds/2.3.0/apache-openjpa/docs/manual.html#jpa_hints_named) seemed to confirm that query hints are vendor specific.
Section 1.8 Query Hints...
"Hints which can not be processed by a particular database or are unknown to OpenJPA are ignored. Hints known to OpenJPA but supplied with an incompatible value will result in an IllegalArgumentException being thrown."
Based on what I've read and what you have linked in the question, I do not believe that there are "vendor-neutral" query hints. The expected behavior is that if a vendor does not support the query hint specified, it will simply be ignored.
来源:https://stackoverflow.com/questions/37598238/jpa-are-query-hints-vendor-specific