Skip to content

Commit

Permalink
queryTimeoutUnit is not copied to DataModifyQuery in executeUpdate
Browse files Browse the repository at this point in the history
Signed-off-by: Vaibhav Vishal <[email protected]>
  • Loading branch information
vavishal authored and lukasj committed Jun 10, 2024
1 parent b3d869a commit b09fbb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ public void copyFromQuery(DatabaseQuery query) {
this.argumentTypeNames = query.argumentTypeNames;
this.argumentValues = query.argumentValues;
this.queryTimeout = query.queryTimeout;
this.queryTimeoutUnit = query.queryTimeoutUnit;
this.redirector = query.redirector;
this.sessionName = query.sessionName;
this.shouldBindAllParameters = query.shouldBindAllParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public static TestSuite suite() {
tests.add("testIncorrectBatchQueryHint");
// can't join different dbs tests.add("testFetchQueryHint");
tests.add("testBatchQueryHint");
tests.add("testCopyFromQuery");
tests.add("testQueryHints");
tests.add("testParallelMultipleFactories");
tests.add("testMultipleFactories");
Expand Down Expand Up @@ -4981,6 +4982,16 @@ public void testParallelMultipleFactories() {
}
}

public void testCopyFromQuery() {
EntityManager em = (EntityManager)getEntityManagerFactory().createEntityManager().getDelegate();
Query query = em.createQuery("SELECT OBJECT(e) FROM Employee e WHERE e.firstName = 'testCopyFromQuery'");
query.setHint(QueryHints.QUERY_TIMEOUT_UNIT, "SECONDS");
ObjectLevelReadQuery olrQuery = (ObjectLevelReadQuery)((JpaQuery)query).getDatabaseQuery();
DataModifyQuery copyQuery = new DataModifyQuery();
copyQuery.copyFromQuery(olrQuery);
assertEquals("QUERY_TIMEOUT_UNIT is not matching.", copyQuery.getQueryTimeoutUnit(), olrQuery.getQueryTimeoutUnit());
}

// The class will be used to test QueryHints.RESULT_COLLECTION_TYPE
public static class CustomerCollection<V> extends HashSet<V> {
}
Expand Down

0 comments on commit b09fbb7

Please sign in to comment.