You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Michael Gentry (JIRA)" <de...@cayenne.apache.org> on 2008/03/02 15:48:16 UTC

[jira] Created: (CAY-994) Add extended enumeration support

Add extended enumeration support
--------------------------------

                 Key: CAY-994
                 URL: https://issues.apache.org/cayenne/browse/CAY-994
             Project: Cayenne
          Issue Type: New Feature
          Components: Cayenne Core Library, Cayenne Documentation, Cayenne Examples, Cayenne Website
    Affects Versions: 3.0
         Environment: All
            Reporter: Michael Gentry
            Assignee: Michael Gentry
             Fix For: 3.0


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.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CAY-994) Add extended enumeration support

Posted by "Michael Gentry (JIRA)" <de...@cayenne.apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Gentry closed CAY-994.
------------------------------

    Resolution: Fixed

Updated code and wiki documentation.

> Add extended enumeration support
> --------------------------------
>
>                 Key: CAY-994
>                 URL: https://issues.apache.org/cayenne/browse/CAY-994
>             Project: Cayenne
>          Issue Type: New Feature
>          Components: Cayenne Core Library, Cayenne Documentation, Cayenne Examples, Cayenne Website
>    Affects Versions: 3.0
>         Environment: All
>            Reporter: Michael Gentry
>            Assignee: Michael Gentry
>             Fix For: 3.0
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.