Adding dynamic finder methods to an entity
The finder
list
command shows the candidate dynamic finder method names whose implementations Roo can automatically generate. In this recipe, we will look at how to add dynamic finder methods to a persistent entity using the finder
add
command. As an example, we will add the findFlightsByDestinationLikeAndOriginLike
method to a Flight
entity.
Getting ready
Refer to the Viewing candidate dynamic finder methods recipe, to create the flight-app
Roo project.
Start the Roo shell from the C:\roo-cookbook\ch03-recipes
directory.
How to do it...
To add dynamic finder methods, follow the given steps:
Set the focus of subsequent commands on the
Flight
entity using afocus
command:roo> focus --class ~.domain.Flight
Add the
findFlightsByDestinationLikeAndOriginLike
dynamic finder method to theFlight
entity using thefinder
add
command:.. roo> finder add findFlightsByDestinationLikeAndOriginLike Updated SRC_MAIN_JAVA\sample\roo\flightapp\domain\Flight.java...