O'Reilly logo

Spring Roo 1.1 Cookbook by Ashish Sarin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a one-to-many (or many-to-many)relationship between entities

In the previous recipe, we saw how the many-to-one (or one-to-one) relationship is established between entities using the field reference command. In this recipe, we'll extend the same example to show how a one-to-many (or many-to-many) relationship can be created using the field set command. The following class diagram shows a one-to-many relationship between the FlightDescription and Flight entities:

Creating a one-to-many (or many-to-many)relationship between entities

In the given figure, you'll notice that we have added a flights field of type Set<Flight> to the FieldDescription entity, reflecting the one-to-many relationship between the FlightDescription ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required