[
https://issues.apache.org/jira/browse/OPENJPA-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18109514#comment-18109514
]
ASF subversion and git services commented on OPENJPA-2986:
----------------------------------------------------------
Commit 21495c4560c083f3ff9d62b96983a0373a1c9d13 in openjpa's branch
refs/heads/OPENJPA-2986 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=21495c456 ]
[OPENJPA-2986] Let setTimeout(null) clear a query timeout
Query.setTimeout(null) passed the null straight to setHint(), which drove
it through FetchConfigurationImpl.setHint() into a reflective call of
setQueryTimeout(int) and failed with a bad-hint-value
IllegalArgumentException. A timeout set through this API could therefore
never be cleared, and getTimeout() kept reporting the stale value.
A null timeout now restores the timeout the query inherits from its entity
manager, which is what the query would have used had setTimeout() never
been called. Deliberately not the value of the configuration, which would
discard an entity manager scoped timeout the caller never set here.
getTimeout() reports the effective fetch plan value rather than the
recorded hint, so it cannot disagree with what the query will actually
use, and StoredProcedureQueryImpl delegates both methods to its query so
the two cannot drift apart.
EntityManagerImpl carries a setTimeout/getTimeout pair too, but those
implement EntityTransaction, a transaction timeout in seconds, and are left
alone here.
> setTimeout(null) cannot clear a previously set query timeout
> ------------------------------------------------------------
>
> Key: OPENJPA-2986
> URL: https://issues.apache.org/jira/browse/OPENJPA-2986
> Project: OpenJPA
> Issue Type: Sub-task
> Components: jpa
> Affects Versions: 4.2.0
> Reporter: Maxim Solodovnik
> Assignee: Richard Zowalla
> Priority: Major
> Fix For: 4.2.0
>
>
> Discussion thread:
> https://github.com/apache/openjpa/pull/144#discussion_r3683006065
> **(low)** `setTimeout(null)` is silently ignored, so once a timeout is set it
> can never be cleared through this API (and `getTimeout()` keeps returning the
> stale value). Should null reset the fetch plan's query timeout to its
> default?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)