solomax commented on code in PR #169:
URL: https://github.com/apache/openjpa/pull/169#discussion_r3891584175
##########
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java:
##########
@@ -780,20 +780,28 @@ public TypedQuery<X> setCacheStoreMode(CacheStoreMode
cacheStoreMode) {
@Override
public Integer getTimeout() {
- Object val = getHints().get(JPAProperties.QUERY_TIMEOUT);
- if (val instanceof Integer) {
- return (Integer) val;
- }
- if (val instanceof Number) {
- return ((Number) val).intValue();
- }
- return null;
+ int timeout = getFetchPlan().getQueryTimeout();
+ return timeout > 0 ? timeout : null;
}
+ /**
+ * Sets the query timeout in milliseconds. A null timeout clears a
timeout
Review Comment:
Is this comment accurate? it states: `A null timeout clears a timeout set
through this method`
##########
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java:
##########
@@ -780,20 +780,28 @@ public TypedQuery<X> setCacheStoreMode(CacheStoreMode
cacheStoreMode) {
@Override
public Integer getTimeout() {
- Object val = getHints().get(JPAProperties.QUERY_TIMEOUT);
- if (val instanceof Integer) {
- return (Integer) val;
- }
- if (val instanceof Number) {
- return ((Number) val).intValue();
- }
- return null;
+ int timeout = getFetchPlan().getQueryTimeout();
Review Comment:
`set` method put timeout to the `hind` while `get` takes it from `fetchPlan`
Is this OK?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]