Я пытаюсь выполнить несколько действий с БД в одном сеансе. Журналы отладки показывают транзакцию Commit, но данные не сохраняются в БД. Я использую Slick 3.2.3 с Scala Play Framework 2.6. Как я могу решить эту проблему.
val d = (for {
dir: Int <- new UploadFileDao().createDocument1(document.documentId, patientId, Some(285),
hospitalId, clinicId, patientType, categoryType, admissionAppointmentNo, documentName,
remarks, description).transactionally
files: Option[Int] <- new UploadFileDao().createFiles1(document.fileList.zipWithIndex.map(l => {
(l._1.hash,
document.documentId,
l._1.fileName, l._1.hash.split("\\.").last,
l._2, true)
}).toSeq)
} yield (dir,files)).transactionally
val errorHandleAction = d.asTry.flatMap {
case Failure(e: Throwable) =>
e.printStackTrace
DBIO.successful(print(e.getMessage))
case Success(s) =>
DBIO.successful(print(s"never reached $s"))
}
val m = db.run( errorHandleAction.transactionally)
This is the debug log->
2019-05-18 16:08:49 +0530 [DEBUG] from slick.basic.BasicBackend.action in application-akka.actor.default-dispatcher-24 - #6: success Some(2)
2019-05-18 16:08:49 +0530 [DEBUG] from slick.basic.BasicBackend.action in application-akka.actor.default-dispatcher-24 - #7: success (1,Some(2))
2019-05-18 16:08:49 +0530 [DEBUG] from slick.basic.BasicBackend.action in application-akka.actor.default-dispatcher-24 - #8: Commit
2019-05-18 16:08:49 +0530 [DEBUG] from slick.basic.BasicBackend.action in application-akka.actor.default-dispatcher-24 - #9: success ()
2019-05-18 16:08:49 +0530 [DEBUG] from slick.basic.BasicBackend.action in application-akka.actor.default-dispatcher-24 - #10: Commit