Reputation: 548
I'm struggling a bit in Slick and i'm a recent Scala/Slick adopter. I'm used to Hibernate and/or Rails ActiveRecord but i'm having a bit difficulty joining plenty of tables.
I have the Following class pattern.
case class User(id: UUID, ..., profile: UserProfile)
case class UserProfile(id: UUID, ..., address: Address)
case class Address(id: UUID, ...)
I'm trying to have this as a Domain Model and having the Persistence Layer just fetch and join the tables to return a domain single object.
Sorry if this is a "newbish" question. I'm just trying to figure out how to "Think Slick".
Upvotes: 2
Views: 443
Reputation: 3921
Understanding plain SQL, it's joins etc helps a lot when using Slick. For example, does the outer join(left/right) order matter, and other interesting questions.
Upvotes: 2
Reputation: 7845
I wrote a small tutorial on play + slick some time ago. check it and see if it helps http://pedrorijo.com/blog/play-slick/
I usually have:
case class CaseClassA(field1, field2, caseClassB_Id)
case class CaseClassB(field3, field4)
but maybe there's a better approach
Upvotes: 0