diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/HapiEmbeddedDatabasesExtension.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/HapiEmbeddedDatabasesExtension.java index f25a382bb64..7a29e24a0ca 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/HapiEmbeddedDatabasesExtension.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/embedded/HapiEmbeddedDatabasesExtension.java @@ -108,10 +108,15 @@ public class HapiEmbeddedDatabasesExtension implements AfterAllCallback { try { myDatabaseInitializerHelper.insertPersistenceTestData(getEmbeddedDatabase(theDriverType), theVersionEnum); } catch (Exception theE) { - ourLog.info( - "Could not insert persistence test data most likely because we don't have any for version {} and driver {}", - theVersionEnum, - theDriverType); + if (theE.getMessage().contains("Error loading file: migration/releases/")) { + ourLog.info( + "Could not insert persistence test data most likely because we don't have any for version {} and driver {}", + theVersionEnum, + theDriverType); + } else { + // throw sql execution Exceptions + throw theE; + } } } diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/H2_EMBEDDED.sql index e84689abc35..99689b7ae08 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/H2_EMBEDDED.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/H2_EMBEDDED.sql @@ -1 +1,91 @@ -INSERT INTO TRM_CONCEPT_MAP_GRP_ELM_TGT (PID, TARGET_CODE, CONCEPT_MAP_URL, TARGET_DISPLAY, TARGET_EQUIVALENCE, SYSTEM_URL, SYSTEM_VERSION, VALUESET_URL, CONCEPT_MAP_GRP_ELM_PID) VALUES (61, NULL, NULL, 'PYRIDOXINE', 'UNMATCHED', NULL, NULL, NULL, 60); +INSERT INTO TRM_CONCEPT ( + PID, + CODEVAL, + CODESYSTEM_PID, + DISPLAY, + INDEX_STATUS, + PARENT_PIDS, + PARENT_PIDS_VC, + CODE_SEQUENCE, + CONCEPT_UPDATED +) VALUES ( + 1, + 'LA4393-0', + 54, + 'CR_1430_Reason no radiation', + 1, + '1415721', + '1415721', + 3, + '2024-05-01 17:02:39.139' + ); + +INSERT INTO TRM_VALUESET_CONCEPT ( + PID, + CODEVAL, + DISPLAY, + INDEX_STATUS, + VALUESET_ORDER, + SOURCE_DIRECT_PARENT_PIDS, + SOURCE_DIRECT_PARENT_PIDS_VC, + SOURCE_PID, + SYSTEM_URL, + SYSTEM_VER, + VALUESET_PID +) VALUES ( + 1, + 'LA4382-3', + 'CR_1550_Radiation treatment location', + 1, + 2, + '1415722', + '1415722', + 1, + 'HTTP://LOINC.ORG', + 'V2.67', + 59 +); + +INSERT INTO TRM_CONCEPT_PROPERTY ( + PID, + PROP_CODESYSTEM, + PROP_DISPLAY, + PROP_KEY, + PROP_TYPE, + PROP_VAL, + PROP_VAL_BIN, + PROP_VAL_LOB, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 154, + 'http://loinc.org', + 'code-A', + 'CODING', + 1, + 'LP98185-9', + '\x48656c6c6f20776f726c6421', + 83006307, + 54, + 1 +); + +INSERT INTO HFJ_BINARY_STORAGE_BLOB ( + BLOB_ID, + BLOB_DATA, + CONTENT_TYPE, + BLOB_HASH, + PUBLISHED_DATE, + RESOURCE_ID, + BLOB_SIZE, + STORAGE_CONTENT_BIN +) VALUES ( + '1', + 72995, + 'TEXT', + 'dc7197cfab936698bef7818975c185a9b88b71a0a0a2493deea487706ddf20cb', + '2024-06-15 09:58:42.92', + '1678', + 16, + '\x48656c6c6f20776f726c6421' +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/MSSQL_2012.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/MSSQL_2012.sql index e84689abc35..ae7b3014efe 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/MSSQL_2012.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/MSSQL_2012.sql @@ -1 +1,91 @@ -INSERT INTO TRM_CONCEPT_MAP_GRP_ELM_TGT (PID, TARGET_CODE, CONCEPT_MAP_URL, TARGET_DISPLAY, TARGET_EQUIVALENCE, SYSTEM_URL, SYSTEM_VERSION, VALUESET_URL, CONCEPT_MAP_GRP_ELM_PID) VALUES (61, NULL, NULL, 'PYRIDOXINE', 'UNMATCHED', NULL, NULL, NULL, 60); +INSERT INTO TRM_CONCEPT ( + PID, + CODEVAL, + CODESYSTEM_PID, + DISPLAY, + INDEX_STATUS, + PARENT_PIDS, + PARENT_PIDS_VC, + CODE_SEQUENCE, + CONCEPT_UPDATED +) VALUES ( + 1, + 'LA4393-0', + 54, + 'CR_1430_Reason no radiation', + 1, + '1415721', + '1415721', + 3, + '2024-05-01 17:02:39.139' + ); + +INSERT INTO TRM_VALUESET_CONCEPT ( + PID, + CODEVAL, + DISPLAY, + INDEX_STATUS, + VALUESET_ORDER, + SOURCE_DIRECT_PARENT_PIDS, + SOURCE_DIRECT_PARENT_PIDS_VC, + SOURCE_PID, + SYSTEM_URL, + SYSTEM_VER, + VALUESET_PID +) VALUES ( + 1, + 'LA4382-3', + 'CR_1550_Radiation treatment location', + 1, + 2, + '1415722', + '1415722', + 1, + 'HTTP://LOINC.ORG', + 'V2.67', + 59 +); + +INSERT INTO TRM_CONCEPT_PROPERTY ( + PID, + PROP_CODESYSTEM, + PROP_DISPLAY, + PROP_KEY, + PROP_TYPE, + PROP_VAL, + PROP_VAL_BIN, + PROP_VAL_LOB, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 154, + 'http://loinc.org', + 'code-A', + 'CODING', + 1, + 'LP98185-9', + 8479927, + 83006307, + 54, + 1 +); + +INSERT INTO HFJ_BINARY_STORAGE_BLOB ( + BLOB_ID, + BLOB_DATA, + CONTENT_TYPE, + BLOB_HASH, + PUBLISHED_DATE, + RESOURCE_ID, + BLOB_SIZE, + STORAGE_CONTENT_BIN +) VALUES ( + '1', + 72995, + 'TEXT', + 'dc7197cfab936698bef7818975c185a9b88b71a0a0a2493deea487706ddf20cb', + '2024-06-15 09:58:42.92', + '1678', + 16, + 7368816 +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/ORACLE_12C.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/ORACLE_12C.sql index e84689abc35..ee801e3afb9 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/ORACLE_12C.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/ORACLE_12C.sql @@ -1 +1,91 @@ -INSERT INTO TRM_CONCEPT_MAP_GRP_ELM_TGT (PID, TARGET_CODE, CONCEPT_MAP_URL, TARGET_DISPLAY, TARGET_EQUIVALENCE, SYSTEM_URL, SYSTEM_VERSION, VALUESET_URL, CONCEPT_MAP_GRP_ELM_PID) VALUES (61, NULL, NULL, 'PYRIDOXINE', 'UNMATCHED', NULL, NULL, NULL, 60); +INSERT INTO TRM_CONCEPT ( + PID, + CODEVAL, + CODESYSTEM_PID, + DISPLAY, + INDEX_STATUS, + PARENT_PIDS, + PARENT_PIDS_VC, + CODE_SEQUENCE, + CONCEPT_UPDATED +) VALUES ( + 1, + 'LA4393-0', + 54, + 'CR_1430_Reason no radiation', + 1, + '1415721', + '1415721', + 3, + SYSDATE + ); + +INSERT INTO TRM_VALUESET_CONCEPT ( + PID, + CODEVAL, + DISPLAY, + INDEX_STATUS, + VALUESET_ORDER, + SOURCE_DIRECT_PARENT_PIDS, + SOURCE_DIRECT_PARENT_PIDS_VC, + SOURCE_PID, + SYSTEM_URL, + SYSTEM_VER, + VALUESET_PID +) VALUES ( + 1, + 'LA4382-3', + 'CR_1550_Radiation treatment location', + 1, + 2, + '1415722', + '1415722', + 1, + 'HTTP://LOINC.ORG', + 'V2.67', + 59 +); + +INSERT INTO TRM_CONCEPT_PROPERTY ( + PID, + PROP_CODESYSTEM, + PROP_DISPLAY, + PROP_KEY, + PROP_TYPE, + PROP_VAL, + PROP_VAL_BIN, + PROP_VAL_LOB, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 154, + 'http://loinc.org', + 'code-A', + 'CODING', + 1, + 'LP98185-9', + HEXTORAW('453d7a34'), + HEXTORAW('8B9D5255'), + 54, + 1 +); + +INSERT INTO HFJ_BINARY_STORAGE_BLOB ( + BLOB_ID, + BLOB_DATA, + CONTENT_TYPE, + BLOB_HASH, + PUBLISHED_DATE, + RESOURCE_ID, + BLOB_SIZE, + STORAGE_CONTENT_BIN +) VALUES ( + '1', + HEXTORAW('28721FB0'), + 'TEXT', + 'dc7197cfab936698bef7818975c185a9b88b71a0a0a2493deea487706ddf20cb', + SYSDATE, + '1678', + 16, + HEXTORAW('1B25E293') +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/POSTGRES_9_4.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/POSTGRES_9_4.sql index e52db927eca..99689b7ae08 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/POSTGRES_9_4.sql +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_2_0/data/POSTGRES_9_4.sql @@ -1,5 +1,91 @@ -INSERT INTO TRM_CONCEPT_MAP_GRP_ELM_TGT (PID, TARGET_CODE, CONCEPT_MAP_URL, TARGET_DISPLAY, TARGET_EQUIVALENCE, SYSTEM_URL, SYSTEM_VERSION, VALUESET_URL, CONCEPT_MAP_GRP_ELM_PID) VALUES (61, NULL, NULL, 'PYRIDOXINE', 'UNMATCHED', NULL, NULL, NULL, 60); -INSERT INTO HFJ_BINARY_STORAGE (CONTENT_ID, RESOURCE_ID, CONTENT_TYPE, STORAGE_CONTENT_BIN, PUBLISHED_DATE ) VALUES ('1', '2', 'TEXT', '\x48656c6c6f20776f726c6421', '2023-06-15 09:58:42.92'); -INSERT INTO TRM_CONCEPT (PID, CODEVAL, PARENT_PIDS_VC ) VALUES (1, 'aCode', '1 2 3 4'); -INSERT INTO TRM_CONCEPT_PROPERTY (PID, PROP_KEY, PROP_VAL_BIN, PROP_TYPE) VALUES (1, 'key', '\x48656c6c6f20776f726c6421', 1); -INSERT INTO TRM_VALUESET_CONCEPT (PID, VALUESET_PID, VALUESET_ORDER, SOURCE_DIRECT_PARENT_PIDS_VC, SYSTEM_URL, CODEVAL) VALUES (1, 59, 1, '1 2 3 4 5 6', 'http://systemUlr', 'codeVal'); +INSERT INTO TRM_CONCEPT ( + PID, + CODEVAL, + CODESYSTEM_PID, + DISPLAY, + INDEX_STATUS, + PARENT_PIDS, + PARENT_PIDS_VC, + CODE_SEQUENCE, + CONCEPT_UPDATED +) VALUES ( + 1, + 'LA4393-0', + 54, + 'CR_1430_Reason no radiation', + 1, + '1415721', + '1415721', + 3, + '2024-05-01 17:02:39.139' + ); + +INSERT INTO TRM_VALUESET_CONCEPT ( + PID, + CODEVAL, + DISPLAY, + INDEX_STATUS, + VALUESET_ORDER, + SOURCE_DIRECT_PARENT_PIDS, + SOURCE_DIRECT_PARENT_PIDS_VC, + SOURCE_PID, + SYSTEM_URL, + SYSTEM_VER, + VALUESET_PID +) VALUES ( + 1, + 'LA4382-3', + 'CR_1550_Radiation treatment location', + 1, + 2, + '1415722', + '1415722', + 1, + 'HTTP://LOINC.ORG', + 'V2.67', + 59 +); + +INSERT INTO TRM_CONCEPT_PROPERTY ( + PID, + PROP_CODESYSTEM, + PROP_DISPLAY, + PROP_KEY, + PROP_TYPE, + PROP_VAL, + PROP_VAL_BIN, + PROP_VAL_LOB, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 154, + 'http://loinc.org', + 'code-A', + 'CODING', + 1, + 'LP98185-9', + '\x48656c6c6f20776f726c6421', + 83006307, + 54, + 1 +); + +INSERT INTO HFJ_BINARY_STORAGE_BLOB ( + BLOB_ID, + BLOB_DATA, + CONTENT_TYPE, + BLOB_HASH, + PUBLISHED_DATE, + RESOURCE_ID, + BLOB_SIZE, + STORAGE_CONTENT_BIN +) VALUES ( + '1', + 72995, + 'TEXT', + 'dc7197cfab936698bef7818975c185a9b88b71a0a0a2493deea487706ddf20cb', + '2024-06-15 09:58:42.92', + '1678', + 16, + '\x48656c6c6f20776f726c6421' +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/H2_EMBEDDED.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/H2_EMBEDDED.sql new file mode 100644 index 00000000000..fd2eb6c3c98 --- /dev/null +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/H2_EMBEDDED.sql @@ -0,0 +1,53 @@ +INSERT INTO HFJ_RES_SEARCH_URL ( + PARTITION_DATE, + PARTITION_ID, + RES_SEARCH_URL, + CREATED_TIME, + RES_ID +) VALUES ( + '2024-04-05', + 1, + 'https://example.com', + '2024-06-29 10:14:39.69', + 1906 +); + +INSERT INTO HFJ_IDX_CMP_STRING_UNIQ ( + PID, + PARTITION_DATE, + PARTITION_ID, + HASH_COMPLETE, + HASH_COMPLETE_2, + IDX_STRING, + RES_ID +) VALUES ( + 2, + '2024-04-05', + 1, + -8173309116900170400, + -7180360017667394276, + 'Patient?birthdate=2024-07-24&family=FAM', + 1906 +); + +INSERT INTO TRM_CONCEPT_DESIG ( + PID, + LANG, + USE_CODE, + USE_DISPLAY, + USE_SYSTEM, + VAL, + VAL_VC, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 106, + 'NL', + '900000000000013009', + 'SYNONYM', + 'HTTP://SNOMED.INFO/SCT', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 54, + 150 +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/MSSQL_2012.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/MSSQL_2012.sql new file mode 100644 index 00000000000..fd2eb6c3c98 --- /dev/null +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/MSSQL_2012.sql @@ -0,0 +1,53 @@ +INSERT INTO HFJ_RES_SEARCH_URL ( + PARTITION_DATE, + PARTITION_ID, + RES_SEARCH_URL, + CREATED_TIME, + RES_ID +) VALUES ( + '2024-04-05', + 1, + 'https://example.com', + '2024-06-29 10:14:39.69', + 1906 +); + +INSERT INTO HFJ_IDX_CMP_STRING_UNIQ ( + PID, + PARTITION_DATE, + PARTITION_ID, + HASH_COMPLETE, + HASH_COMPLETE_2, + IDX_STRING, + RES_ID +) VALUES ( + 2, + '2024-04-05', + 1, + -8173309116900170400, + -7180360017667394276, + 'Patient?birthdate=2024-07-24&family=FAM', + 1906 +); + +INSERT INTO TRM_CONCEPT_DESIG ( + PID, + LANG, + USE_CODE, + USE_DISPLAY, + USE_SYSTEM, + VAL, + VAL_VC, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 106, + 'NL', + '900000000000013009', + 'SYNONYM', + 'HTTP://SNOMED.INFO/SCT', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 54, + 150 +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/ORACLE_12C.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/ORACLE_12C.sql new file mode 100644 index 00000000000..442d6661919 --- /dev/null +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/ORACLE_12C.sql @@ -0,0 +1,53 @@ +INSERT INTO HFJ_RES_SEARCH_URL ( + PARTITION_DATE, + PARTITION_ID, + RES_SEARCH_URL, + CREATED_TIME, + RES_ID +) VALUES ( + SYSDATE, + 1, + 'https://example.com', + SYSDATE, + 1906 +); + +INSERT INTO HFJ_IDX_CMP_STRING_UNIQ ( + PID, + PARTITION_DATE, + PARTITION_ID, + HASH_COMPLETE, + HASH_COMPLETE_2, + IDX_STRING, + RES_ID +) VALUES ( + 2, + SYSDATE, + 1, + -8173309116900170400, + -7180360017667394276, + 'Patient?birthdate=2024-07-24&family=FAM', + 1906 +); + +INSERT INTO TRM_CONCEPT_DESIG ( + PID, + LANG, + USE_CODE, + USE_DISPLAY, + USE_SYSTEM, + VAL, + VAL_VC, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 106, + 'NL', + '900000000000013009', + 'SYNONYM', + 'HTTP://SNOMED.INFO/SCT', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 54, + 150 +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/POSTGRES_9_4.sql b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/POSTGRES_9_4.sql new file mode 100644 index 00000000000..fd2eb6c3c98 --- /dev/null +++ b/hapi-fhir-jpaserver-test-utilities/src/main/resources/migration/releases/V7_4_0/data/POSTGRES_9_4.sql @@ -0,0 +1,53 @@ +INSERT INTO HFJ_RES_SEARCH_URL ( + PARTITION_DATE, + PARTITION_ID, + RES_SEARCH_URL, + CREATED_TIME, + RES_ID +) VALUES ( + '2024-04-05', + 1, + 'https://example.com', + '2024-06-29 10:14:39.69', + 1906 +); + +INSERT INTO HFJ_IDX_CMP_STRING_UNIQ ( + PID, + PARTITION_DATE, + PARTITION_ID, + HASH_COMPLETE, + HASH_COMPLETE_2, + IDX_STRING, + RES_ID +) VALUES ( + 2, + '2024-04-05', + 1, + -8173309116900170400, + -7180360017667394276, + 'Patient?birthdate=2024-07-24&family=FAM', + 1906 +); + +INSERT INTO TRM_CONCEPT_DESIG ( + PID, + LANG, + USE_CODE, + USE_DISPLAY, + USE_SYSTEM, + VAL, + VAL_VC, + CS_VER_PID, + CONCEPT_PID +) VALUES ( + 106, + 'NL', + '900000000000013009', + 'SYNONYM', + 'HTTP://SNOMED.INFO/SCT', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 'SYSTOLISCHE BLOEDDRUK - EXPIRATIE', + 54, + 150 +); diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/embedded/HapiSchemaMigrationTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/embedded/HapiSchemaMigrationTest.java index 0cc6156dfdd..daf26965bc8 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/embedded/HapiSchemaMigrationTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/embedded/HapiSchemaMigrationTest.java @@ -171,7 +171,7 @@ public class HapiSchemaMigrationTest { final Object allCountValue = allCount.get(0).values().iterator().next(); if (allCountValue instanceof Number allCountNumber) { - assertThat(allCountNumber.intValue()).isEqualTo(1); + assertThat(allCountNumber.intValue()).isEqualTo(2); } try (final Connection connection = theDatabase.getDataSource().getConnection()) { @@ -230,7 +230,7 @@ public class HapiSchemaMigrationTest { final Object queryResultValueVal = queryResultValuesVal.iterator().next(); assertThat(queryResultValueVal).isInstanceOf(Number.class); if (queryResultValueVal instanceof Number queryResultNumber) { - assertThat(queryResultNumber.intValue()).isEqualTo(1); + assertThat(queryResultNumber.intValue()).isEqualTo(2); } assertThat(nullValVcCount).hasSize(1); @@ -244,7 +244,7 @@ public class HapiSchemaMigrationTest { final Object allCountValue = allCount.get(0).values().iterator().next(); if (allCountValue instanceof Number allCountNumber) { - assertThat(allCountNumber.intValue()).isEqualTo(1); + assertThat(allCountNumber.intValue()).isEqualTo(2); } try (final Connection connection = theDatabase.getDataSource().getConnection()) {