slckin
slckin

Reputation: 929

How to define a slick joinCondition

In the scaladays 2013 talk http://www.parleys.com/play/51c2e20de4b0d38b54f46243/chapter55/agenda it talks about "joinCondition"

For example:

implicit def autojoin1 = joinCondition[Sites,Devices](_.id === _.siteId)
implicit def autojoin2 = joinCondition[Devices,Computers](_.computerId === _.id)
sites.autoJoin(devices).further(computers)
  : Query[_,(Site,Computer)]
sites.autoJoin(devices).autoJoinVia(computers)(_._2)
 : Query[_,((Site,Device),Computer)]

I'm very new to scala, and can't figure out what joinCondition is, I can't find any method or anything named that in slick(1.0.0) and can't get it to work, what is it?

Upvotes: 2

Views: 311

Answers (2)

N.Martignole
N.Martignole

Reputation: 579

Check also this blog article, that presents a solution for Slick 2.0 http://tikokelottlegyenviz.blogspot.fr/2013/08/scala-slick-left-join.html

Upvotes: 1

cvogt
cvogt

Reputation: 11270

As said in the talk (but not listed in the slides) the complete autoJoin feature is not currently offered by Slick, but part of a demo Play project we prepared. The code is here https://github.com/cvogt/play-slick/blob/scaladays2013/samples/computer-database/app/util/autojoin.scala (and in the other files in https://github.com/cvogt/play-slick/blob/scaladays2013/samples/computer-database/app/)

Upvotes: 4

Related Questions