Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
254 views
in Technique[技术] by (71.8m points)

java - JPA, are query hints vendor specific?

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...