Announcement Announcement Module
Collapse
No announcement yet.
Suggestions: findByExample (QBE) for Roo Entities Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suggestions: findByExample (QBE) for Roo Entities

    Hi all,

    I had a look at the Entity Aspect generated by Roo. It looks good to me and I believe it is very useful for quickly together applications. However I have one suggestion for the Entity Aspect.

    What about including a findByExample (QBE) method that accepts an entity of the same type and based on the values in the entity puts together criterias (using JPA criteria) and returns matching entities? I believe this would make it even more powerful as usually entities are queried by criterias such as names etc. rather than the id.

    Best Regards
    Walter

  • #2
    Hi Walter

    Thanks for having a look at Roo and offering this suggestion.

    The present dynamic finder feature was designed to get something built quickly. We would like to improve it, though. One design we did that looked interesting was to code generate a method chain (http://martinfowler.com/dslwip/MethodChaining.html) and therefore developers would enjoy a totally type-safe, code-completion aware way to build any arbitrary query expression - including visiting associated objects. Do you think this would be attractive? You'd be able to do something like Vet.find().firstName().like("Ben").or().comment(). equals("Foo").execute(). One issue we encountered was how to add braces into the expression, but from memory we found a reasonable way. I have the code on my workstation, but I'm travelling at present and only have my laptop with me.

    One of the challenges of QBE is the difficulty of expressing numeric and date ranges, plus associations with other objects. I think the ideal world would be to support all approaches, meaning of existing dynamic finder model, a method chaining model, and a QBE that converts into a method chain for execution. There's no reason this wouldn't be possible.

    If you're interested in this area, please feel free to raise an enhancement request in our Jira. We won't get time to look at it before 1.0.0 but it will provide a good place to collect community ideas, feedback and votes on how many people are interested in it.

    Comment

    Working...
    X