/** * Select only job without dependent tables */ def selectByWithDeps(jobId: Int): Option[JobDeps] = { execute { DbSchema.db.withSession { implicit session: Session => session.withTransaction { // fill the dependent instances with empty data val query = for { job <- schema.Jobs if job.jobId === jobId && job.isDeleted === Active.value jty <- schema.JobTypes if jty.jtyId === job.jtyId && jty.isDeleted === Active.value jtm <- schema.JobTemplates if jtm.jtmId === jty.jtmId && jtm.isDeleted === Active.value src <- schema.DataSources if src.srcId === jtm.srcId && src.isDeleted === Active.value dst <- schema.DataDestinations if dst.destId === jty.destId && dst.isDeleted === Active.value } yield (job, jty, jtm, src, dst) val f = (JobDeps.apply _).tupled query.firstOption.map(t => f(t)) } } } }