Announcement Announcement Module
Collapse
No announcement yet.
How can I get my findBy methods to accept multiple values? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I get my findBy methods to accept multiple values?

    I would like to be able to find by multiple values. I modified the generated xxx_Roo_Finder.aj class so that the created query is:
    Query q = em.createQuery("SELECT Pim FROM Pim AS pim WHERE pim.qcguid IN (:qcguid)");
    but this failed. It threw an "invalid number" exception - the generated query had:
    ...WHERE (t0.qcguid IN (?)) [params=(String) 1,2])

    is there a way to get it to accept a list of values that a field can be equal to instead of a single value?

  • #2
    Roo can generate this kind of finder for you. For example if you have a collection type field called toppings, you can create a finder for your pizza object like so: findPizzasByToppings. If you generate that finder you can review the generated code to see how it would need to look like if you were interested in writing your own custom find method.

    HTH,
    Stefan

    Comment

    Working...
    X