Controlling auto-generated methods of persistent entities
When a persistent entity is created using Roo, a number of methods are auto-generated to simplify usage and testing of the entity. For instance, when the Flight
entity was created in the Creating persistent entities recipe, the corresponding Flight_Roo_Entity.aj
AspectJ ITD file was created with methods like persist
, remove
, merge
, flush
, findFlight
, and so on.
In this recipe we'll look at how to control the generation of entity methods by:
Specifying the prefix to be used for a method
Instructing Roo not to generate a particular method
For the purpose of this recipe, we'll instruct Roo to do the following for the Flight
entity:
Change the name of the
persist
auto-generated method tosave
Change the name of the
findFlight
auto-generated method tofinderForFlight
Don't generate
countFlights
andfindFlightEntries
methods
Getting ready
Exit the Roo shell and delete the contents of the C:\roo-cookbook\ch02-recipes
directory.
Execute the ch02_jsr303_fields...