Many-to-many relationships are also very common in real-world applications. In this recipe, we will learn how to use Mapper to create such relationships. To do this, we will create a model for a school where we can have one student attending many subjects and one subject having many students.
You can use any of the projects we have used in the previous sections of this chapter. It is up to you whether to change an existing project or duplicate it.
To create a many-to-many relationship, carry out the following steps:
modelpackage with the following code:
package code.model import net.liftweb.mapper._ class Student extends LongKeyedMapper[Student] with ...