Jun 22nd, 2010, 04:16 AM
Dynamic finder scaffolding with blank fields
I'm trying Spring Roo and trying the dynamic finders functionality..
At first it looks like a very promising feature, to be able to create search methods with a few parameters based on the method name just using some convention but the way it works feels somehow surprising
for example, when you create a dynamic finder, lets say "findPizzasByNameLikeAndDescriptionLike", the scaffolded functionality you get treats both fields as required throwing an exception if they are not filled up, and they are treated as required even if the finder user and OR instead of And..
So you can not search just by name or just by description leaving the other field empty so it's not taken into account on the search results
I think that what most users would expect when they use a search form with a few fields, is that they can fill up some of them and leave the ones that they donīt want to include in the search
As it is right now, I find hardly useful this functionality , even if you push in the "findPizzasByNameLikeAndDescriptionLike" into the PizzaController and replace blanks with asterisks so you can get it as most users would expect it to work, you will get the hql/sql making comparisons in all the columns which would be at beast unnecessary..
It's there any plan to improve this or to create a search functionality that would provide some form of filtering?
Regards and thanks for the effort put in Roo
Sep 22nd, 2010, 08:26 AM
Dynamic finder with required/ optional fields
I too have the same requirement. I used the Or clause for the dynamic finder for eg: findPeopleByDateOfBirthBetweenOrLocationLikeOrAge
I expect that only few fields will be entered by the user. But the generated code requires that all the fields are mandatory. Is there some roo way to specify that the some of the fields are optional?
Please address the issue
And Ya, Excellent effort with Roo. Kudos to the development team.
Sep 22nd, 2010, 11:31 AM
Indeed, currently all finder generated search fields are mandatory which does make sense for AND combinations but less so for OR combinations as mentioned above.
Please feel free to open a Jira improvement ticket so I can take a look.
In the meantime, you always have the opportunity to change things as needed in your code.
Sep 25th, 2010, 04:36 AM
Thanks for your reply.
Will make changes in my code to accommodate my requirement.
Dec 8th, 2010, 02:36 AM
Created a Jira entry for the same, as I couldn't find one.
Tags for this Thread