Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-1383

Mapping enums to sets should be facilitated by the @ElementCollection JPA2 annotation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.1.0.RC1
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      An enumeration should be able to be added to a set object (or any object for that matter but enums are the safest 1st level case).

      So that syntax such as:
      "
      enum type --class ~.Regions
      enum constant --name EUROPE
      enum constant --name ASIA
      enum constant --name NORTH_AMERICA
      enum constant --name SOUTH_AMERICA
      enum constant --name OCEANIA

      entity --class ~.product
      field set --fieldName supportedRegions --enum ~.Regions // clear & consistent

      // or

      field set --fieldName supportedRegions --element ~.Regions // consistent

      // or

      field other --fieldName supportedRegions --type java.util.Set --comment 'this would require the use to explicitly set the collection type (in this case ~.Regions)' // obvious single directionality but pain in the ass due to post editing of the generated code. (which is what this bug is trying to solve to begin with)
      "

      In these cases the generated field should be generated with the "@ElementCollection" annotation.

      Also note that this could go beyond the realm of enums to basically any type but in the case of roo, enums are the safest, easiest and most common unsupported case (from my perspective).

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            bjc Benjamin Conlan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: