title: How do I model a relational database link-table with Scala?
body: <p>I need to do quite a few many to many mapping of objects in Scala and save it to a relational database.</p>
  
  <p>Here is a fake example to simplify the problem:</p>
  
  <p>Let's say we want to model lecture rooms and students. A lecture room may have many students, but those students can also go to different rooms. From a relational database model point of view, you would create 3 tables, one for ROOM, one for STUDENT and one to link students and rooms, ROOM_STUDENT.</p>
  
  <p>Let's say the tables look like this:</p>
  
  <pre><code>ROOM
  -----
  id
  subject
  
  STUDENT
  -------
  id
  name
  
  ROOM_STUDENT
  -------------
  room_id
  student_id
  </code></pre>
  
  <p>If I want to use Scala to access (and maybe create) such a database, how will one do this with, say, ScalaQuery or SLICK, or is there a better Scala solution? Should I use case classes with this in some way, or just plain old SQL in some way or another?</p>
  
  <p>I'm basically hoping for two hints here, 1. a good way to present the STUDENT and ROOM in Scala, 2. some ideas towards relational database persistence for this problem.</p>