Results 1 to 2 of 2

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

  1. #1

    Default 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. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    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
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •