How to use Slick's mapped tables with foreign keys?

前提是你 提交于 2019-11-30 13:40:37

The short answer is: Use ids instead of object references and use Slick queries to dereference ids. You can put the queries into methods for re-use.

That would make your case classes look like this:

case class Task(id: Option[Long], title: String, nextTaskId: Option[Long])
case class TaskList(label: String, firstTaskId: Option[Long])

I'll publish an article about this topic at some point and link it here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!