Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Spring Roo : what is a dynamic finder?

Tags:

spring-roo

I am getting a look at the Spring Web framework with Roo.

And, I am looking at the vote.roo supplied in the sample directory.

This line called my attention:

finder list --class com.springsource.vote.domain.Vote --depth 2 --filter reg,betw,IpEq

In Spring Roo : what is a dynamic finder ? What does mean this line?

Thanks

like image 581
djondal Avatar asked Mar 07 '11 19:03

djondal


1 Answers

Roo can be used to generate Finder methods on your Entity classes. In other words, it will create a static method on an Entity that can query the back end for a particular instance of that Entity based on some provided field values.

From the Roo prompt, the finder list command shows you all of the finders that Roo can create for you. The 'depth' option sets the number of fields on that entity that you want to include in the query. So, the line you called out is saying ...

  1. Show me methods that Roo can create for me on the Vote entity
  2. Show methods that include two fields
  3. Only show methods that deal with the "reg", "betw", and "IpEq" fields on the Vote entity.

From there, you can use the finder add command to choose which specific dynamic finder method to create.

like image 139
Peter Wagener Avatar answered Oct 18 '22 03:10

Peter Wagener