Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1935

EJBQL; Handling Collection as Parameter in IN Expression

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.M1
    • 4.0.M2
    • None
    • None

    Description

      Consider an EJBQL expression fragment...

      ... p.toArtist IN (:artists)
      

      ...where :artists may be bound to a Collection such as List or Set. Cayenne presently takes the named or positional parameter bound to the collection to be a member of the set of elements to which the lvar should be a member rather than the set itself. Obviously this doesn't process correctly.

      This patch will mean that in this situation above, the parameter bound to the Collection is expanded to actually be the set of elements to which the LVAR should be a member.

      There is some discussion of this here and here.

      Because some query systems support an unbracketed collection-parameter for IN, "EJBQLParser.jjt" has been modified in this patch to allow for either approach; hence a query of the following form would also be supported;

      ... p.toArtist IN :artists
      

      Note that this new functionality only applies if there is a single unbracketed parameter or if there is a single bracketed parameter - it does not take effect if there are multiple parameters in play. If there is a single unbracketed parameter that is not a collection then it will function as if that parameter were bracketed.

      Attachments

        1. CAY-1935-17may2014_in.patch
          19 kB
          Andrew Ponsonby Lindesay

        Activity

          People

            Unassigned Unassigned
            apl Andrew Ponsonby Lindesay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: