JPA, are query hints vendor specific?

僤鯓⒐⒋嵵緔 提交于 2020-01-06 23:03:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!