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 persistent entities

In this recipe we look at how Spring Roo simplifies the creation of JPA entities using the entity and field commands. In this recipe we'll create a Flight JPA entity which has a composite primary key. Refer to the Creating a many-to-one relationship between entities recipe of Chapter 3, Advanced JPA Support in Spring Roo to see how to create persistent entities with surrogate keys.

The following figure shows the attributes of the Flight entity and its composite primary key (FlightKey):

Creating persistent entities

Getting ready

Exit the Roo shell and delete the contents of the C:\roo-cookbook\ch02-recipes directory.

Execute the ch02_jpa_setup.roo script. ...

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