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

Add extended enumeration support

    XMLWordPrintableJSON

Details

    Description

      Current Cayenne support for Java 1.5 enumerations is relatively simplistic. Given:

      enum Color

      { RED, GREEN, BLUE }

      Cayenne will store 0, 1, and 2 (respectively) for a numeric column, or "RED", "GREEN", and "BLUE" for a string column. There is no way to specify your own values for the enumerations, which is especially important when mapping to an existing schema. Also, in the case of numeric types, the order they are declared is fragile. If someone later sorts the colors to be BLUE, GREEN, RED, then the values of BLUE and RED will be swapped (and incorrect) on future reads from the database.

      Cayenne needs to be able to support explicitly mapping the enumeration to the database value.

      Attachments

        Activity

          People

            blacknext Michael Gentry
            blacknext Michael Gentry
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: