Skip to content

Instantly share code, notes, and snippets.

@nicmarti
Created May 26, 2014 23:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicmarti/b2714edaaed2f204e785 to your computer and use it in GitHub Desktop.
Save nicmarti/b2714edaaed2f204e785 to your computer and use it in GitHub Desktop.
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment