loicdescotte
5/26/2014 - 11:30 PM

Slick 2.x left join

Slick 2.x left join

object JournauxRepository {
  def allWithOperateurs():Seq[(Journal, Operateur, Option[String])] = {
    DB.withSession {
      implicit s =>
        val result = for {
          ((journal, operateur), intervenant) <- Journaux leftJoin Operateurs on(_.idOperateur === _.id) leftJoin Intervenants on(_._1.idIntervenant === _.idAgence)
        } yield (journal,operateur,intervenant.nom.?)
          result.run
    }
  }
  // We must use intervenant.nom.? and we cannot use intervenant, as 
}