Skip to content
Snippets Groups Projects
Verified Commit 55b01e79 authored by Jan-Niclas Strüwer's avatar Jan-Niclas Strüwer
Browse files

fixed database lazy loading

parent 1c576009
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.