1

I am trying to execute multiple DB actions in the same session. DEBUG logs show transaction Commit, But data not persistent on DB. I am using slick 3.2.3 with Scala Play framework 2.6. How can I resolve this issue.

 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

0 Answers0