You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "bernard (JIRA)" <ji...@apache.org> on 2010/02/25 21:40:27 UTC

[jira] Created: (OPENJPA-1541) Support Enum as Primary Key Type

Support Enum as Primary Key Type
--------------------------------

                 Key: OPENJPA-1541
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1541
             Project: OpenJPA
          Issue Type: New Feature
          Components: jpa
    Affects Versions: 2.0.0-beta
         Environment: All
            Reporter: bernard
            Priority: Critical


Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too:

http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html

It would be good to also include this in the specification because, not to support type safety in primary keys is fairly sad.

Enum is a basic language feature, and most applications would enjoy significant benefits by mapping the keys of those little system behavior controlling lookup tables to enums.

Consider a payment_type table. One can only generate the IDs of the table and use them for switching safely when the ids are mapped to enums. Any such application would typically have a PaymentType enum anyway.



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


[jira] Updated: (OPENJPA-1541) Support Enum as Primary Key Type

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1541:
----------------------------------

    Component/s: competitive

> Support Enum as Primary Key Type
> --------------------------------
>
>                 Key: OPENJPA-1541
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1541
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: competitive, jpa
>    Affects Versions: 2.0.0-beta
>         Environment: All
>            Reporter: bernard
>            Priority: Critical
>
> Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too:
> http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
> It would be good to also include this in the specification because, not to support type safety in primary keys is fairly sad.
> Enum is a basic language feature, and most applications would enjoy significant benefits by mapping the keys of those little system behavior controlling lookup tables to enums.
> Consider a payment_type table. One can only generate the IDs of the table and use them for switching safely when the ids are mapped to enums. Any such application would typically have a PaymentType enum anyway.

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


[jira] Commented: (OPENJPA-1541) Support Enum as Primary Key Type

Posted by "Marc Logemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912413#action_12912413 ] 

Marc Logemann commented on OPENJPA-1541:
----------------------------------------

I just wanted to migrate to OpenJPA 2.0.1 but this missing feature hindered me. Did it really got lost?

> Support Enum as Primary Key Type
> --------------------------------
>
>                 Key: OPENJPA-1541
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1541
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: jpa
>    Affects Versions: 2.0.0-beta
>         Environment: All
>            Reporter: bernard
>            Priority: Critical
>
> Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too:
> http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
> It would be good to also include this in the specification because, not to support type safety in primary keys is fairly sad.
> Enum is a basic language feature, and most applications would enjoy significant benefits by mapping the keys of those little system behavior controlling lookup tables to enums.
> Consider a payment_type table. One can only generate the IDs of the table and use them for switching safely when the ids are mapped to enums. Any such application would typically have a PaymentType enum anyway.

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


[jira] Commented: (OPENJPA-1541) Support Enum as Primary Key Type

Posted by "Marc Logemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912876#action_12912876 ] 

Marc Logemann commented on OPENJPA-1541:
----------------------------------------

Is this documented somwhere in the JPA docs that the enum ID feature is gone. I ve read a document where all the "changes" (from 1.x to 2.x) are documented but i cant remember reading something about Enums.

> Support Enum as Primary Key Type
> --------------------------------
>
>                 Key: OPENJPA-1541
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1541
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: competitive, jpa
>    Affects Versions: 2.0.0-beta
>         Environment: All
>            Reporter: bernard
>            Priority: Critical
>
> Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too:
> http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
> It would be good to also include this in the specification because, not to support type safety in primary keys is fairly sad.
> Enum is a basic language feature, and most applications would enjoy significant benefits by mapping the keys of those little system behavior controlling lookup tables to enums.
> Consider a payment_type table. One can only generate the IDs of the table and use them for switching safely when the ids are mapped to enums. Any such application would typically have a PaymentType enum anyway.

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


[jira] Commented: (OPENJPA-1541) Support Enum as Primary Key Type

Posted by "bernard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912918#action_12912918 ] 

bernard commented on OPENJPA-1541:
----------------------------------

AFAIK JSR220 (EJB 3.0) and JSR317 (JPA 2.0) do not include enums in id fields. Marc, may I ask which provider you are using and why you want to migrate?

> Support Enum as Primary Key Type
> --------------------------------
>
>                 Key: OPENJPA-1541
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1541
>             Project: OpenJPA
>          Issue Type: New Feature
>          Components: competitive, jpa
>    Affects Versions: 2.0.0-beta
>         Environment: All
>            Reporter: bernard
>            Priority: Critical
>
> Enums work as primary keys in TopLink and EclipseLink. DataNucleus supports them, too:
> http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
> It would be good to also include this in the specification because, not to support type safety in primary keys is fairly sad.
> Enum is a basic language feature, and most applications would enjoy significant benefits by mapping the keys of those little system behavior controlling lookup tables to enums.
> Consider a payment_type table. One can only generate the IDs of the table and use them for switching safely when the ids are mapped to enums. Any such application would typically have a PaymentType enum anyway.

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