Skip to content

Commit

Permalink
add Query.setTimeout()
Browse files Browse the repository at this point in the history
see #383
  • Loading branch information
gavinking committed Aug 21, 2023
1 parent 8afd89f commit 1cc4d0f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api/src/main/java/jakarta/persistence/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,20 @@ Query setParameter(int position, Date value,
*/
CacheStoreMode getCacheStoreMode();

/**
* Set the query timeout.
* @param timeout the timeout, or null to indicate no timeout
* @return the same query instance
* @since 3.2
*/
Query setTimeout(Integer timeout);

/**
* The query timeout.
* @since 3.2
*/
Integer getTimeout();

/**
* Return an object of the specified type to allow access to
* the provider-specific API. If the provider's query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ StoredProcedureQuery setParameter(int position,
*/
StoredProcedureQuery setCacheStoreMode(CacheStoreMode cacheStoreMode);

/**
* Set the query timeout.
* @param timeout the timeout, or null to indicate no timeout
* @return the same query instance
* @since 3.2
*/
StoredProcedureQuery setTimeout(Integer timeout);

/**
* Register a positional parameter.
* All parameters must be registered.
Expand Down
7 changes: 7 additions & 0 deletions api/src/main/java/jakarta/persistence/TypedQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,11 @@ TypedQuery<X> setParameter(int position, Date value,
*/
TypedQuery<X> setCacheStoreMode(CacheStoreMode cacheStoreMode);

/**
* Set the query timeout.
* @param timeout the timeout, or null to indicate no timeout
* @return the same query instance
* @since 3.2
*/
TypedQuery<X> setTimeout(Integer timeout);
}

0 comments on commit 1cc4d0f

Please sign in to comment.