In the previous recipe, we learned how to map a Scala class to a database table using Mapper. However, we have mapped a simple class with only one attribute, and of course, we will not face this while dealing with real-world applications.
We will probably need to work with more complex data such as the one having one-to-many or many-to-many relationships. An example of this kind of relationship would be an application for a store where you'll have customers and orders, and we need to associate each customer with the orders he or she placed. This means that one customer can have many orders.
In this recipe, we will learn how to create such relationships using Mapper.
We will modify the code from the last section by adding a one-to-many relationship into the Contact
class. You can use the same project from before or duplicate it and create a new project.