diff --git a/src/main/kotlin/de/fraunhofer/iem/dataprovider/sarif/SarifExtensions.kt b/src/main/kotlin/de/fraunhofer/iem/dataprovider/sarif/SarifExtensions.kt index 74ec79f60a10cc7319437b26ad8cd12eba4511c5..bf90606284b159bcb5d01d5cb6cdec6868a3b90a 100644 --- a/src/main/kotlin/de/fraunhofer/iem/dataprovider/sarif/SarifExtensions.kt +++ b/src/main/kotlin/de/fraunhofer/iem/dataprovider/sarif/SarifExtensions.kt @@ -11,7 +11,7 @@ import java.sql.Timestamp import java.time.Instant import java.util.* -fun de.fraunhofer.iem.dataprovider.sarif.Rule.asDbObject(): de.fraunhofer.iem.dataprovider.toolResult.Rule { +fun de.fraunhofer.iem.dataprovider.sarif.Rule.asDbObject(): Rule { val rule = Rule() rule.sarifRuleId = this.id rule.shortDescription = this.shortDescription.text diff --git a/src/main/kotlin/de/fraunhofer/iem/dataprovider/taskManager/tasks/ProcessTask.kt b/src/main/kotlin/de/fraunhofer/iem/dataprovider/taskManager/tasks/ProcessTask.kt index cc7ec22e804affe081db6dee84b1cd9454bd1fd0..b9fe3691b0d954200e131faa1e01cdea0969c338 100644 --- a/src/main/kotlin/de/fraunhofer/iem/dataprovider/taskManager/tasks/ProcessTask.kt +++ b/src/main/kotlin/de/fraunhofer/iem/dataprovider/taskManager/tasks/ProcessTask.kt @@ -58,19 +58,15 @@ sealed class SarifTask : ProcessTask() { logger.info("Handle Process return in $javaClass") val sarifResult = getSarifFromFilePath(resultPath) -// val repo = repository.findById(repoId) + val repo = repository.findById(repoId) val sarifDb = sarifResult.asDbObject() val results = toolRunRepository.saveAll(sarifDb) - results.forEach { - val dbres = toolRunRepository.findById(it.id!!).get() -// Hibernate.initialize(dbres.toolResults) - logger.info(dbres.toString()) - } -// repo.ifPresent { + + repo.ifPresent { // Hibernate.initialize(it.toolRuns) // TODO: this fails because the session seems to be closed and add won't work because toolRuns are loaded lazily -// it.toolRuns.addAll(results) -// repository.save(it) -// } + it.addToolResults(results) + repository.save(it) + } sendResult(sarifResult) } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8dd67df9a324eb2314461c59a30415d9788e4e6a..2601e3563a0a2f2763ffab9c06935584370e73a5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,6 +3,8 @@ OPENCODE_GITLAB_URL=https://gitlab.opencode.de/ OPENCODE_GITLAB_TOKEN=${OPENCODE_TOKEN} GITHUB_URL=https://gitlab.opencode.de/ GITHUB_TOKEN=${GITHUB_TOKEN} +GIT_PROJECT_PATH=${GIT_PROJECT_PATH} +ODC_OUTPUT_PATH=${ODC_OUTPUT_PATH} spring.datasource.url=jdbc:postgresql://localhost:5432/dataprovider spring.datasource.username=sa spring.datasource.password=password @@ -10,6 +12,7 @@ spring.jpa.generate-ddl=true spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.format_sql=true -GIT_PROJECT_PATH=${GIT_PROJECT_PATH} -ODC_OUTPUT_PATH=${ODC_OUTPUT_PATH} +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true +spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=false +spring.jpa.open-in-view=false #logging.level.root=DEBUG \ No newline at end of file