Browse Source
Merge pull request #16320 from qjsoq/fix-jdbc-template-query-timeout-key
Fixed NamedParameterJdbcTemplate ignoring JAVAX_PERSISTENCE_QUERY_TIMEOUT
pull/16326/head
Viacheslav Klimov
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
4 deletions
-
dao/src/main/java/org/thingsboard/server/dao/sql/NamedParameterJdbcTemplateConfiguration.java
-
dao/src/test/java/org/thingsboard/server/dao/sql/JdbcTemplateTest.java
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
|
|
|
|
package org.thingsboard.server.dao.sql; |
|
|
|
|
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
@ -16,7 +17,7 @@ import java.util.concurrent.TimeUnit; |
|
|
|
@Slf4j |
|
|
|
public class NamedParameterJdbcTemplateConfiguration { |
|
|
|
|
|
|
|
@Value("${spring.jpa.properties.javax.persistence.query.timeout:30000}") |
|
|
|
@Value("${spring.jpa.properties.jakarta.persistence.query.timeout:30000}") |
|
|
|
private int queryTimeout; |
|
|
|
|
|
|
|
private final NamedParameterJdbcTemplate namedParameterJdbcTemplate; |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
|
|
|
|
package org.thingsboard.server.dao.sql; |
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
@ -12,7 +13,7 @@ import org.thingsboard.server.dao.AbstractJpaDaoTest; |
|
|
|
import static org.junit.jupiter.api.Assertions.assertThrows; |
|
|
|
|
|
|
|
@TestPropertySource(properties = { |
|
|
|
"spring.jpa.properties.javax.persistence.query.timeout=500" |
|
|
|
"spring.jpa.properties.jakarta.persistence.query.timeout=500" |
|
|
|
}) |
|
|
|
public class JdbcTemplateTest extends AbstractJpaDaoTest { |
|
|
|
|
|
|
|
|