Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] enum as primary key

Hi Chris,

I do that, too.
My wish is to have this included in the JPA spec so that best
practices are portable. Currently they are't. Have you tried OpenJPA,
Hibernate?

Regards

Bernard

On Thu, 25 Feb 2010 13:33:27 -0800, you wrote:

>I'm currently using enum as a PrimaryKey in our project with EclipseLink. 
>It's definition is as follows:
>
>   @Id @Column(
>        name       = "ID",
>        length     = 20
>    ) 
>    @Enumerated( EnumType.STRING )
>    private Key id;
>
>
>Then just define your enum as you would like.
>
>Chris Mathrusse
>christopher.mathrusse@xxxxxxxxxx
>Sybase, Inc
>
>
>
>From:
><bht@xxxxxxxxxxxxx>
>To:
>EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
>Date:
>02/25/2010 11:49 AM
>Subject:
>[eclipselink-users] enum as primary key
>Sent by:
><eclipselink-users-bounces@xxxxxxxxxxx>
>
>
>
>Hi,
>
>I am using enum as primary key in TopLink and EclipseLink. 
>
>The JPA 2.0 specification does not include it in "2.4 Primary Keys and
>Entity Identity"
>
>However, DataNucleus lists it at
>http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
>, assuming in comments that it is standard JPA.
>
>Does enyone know of any plans or chance to include this in the
>specification because, quite honestly, it would be fairly sad not to
>support it. Enum is a basic language feature, and most applications
>would enjoy significant benefits by mapping the keys of those little
>SQL whatever-type lookup tables to enums.
>
>Many thanks.
>
>Bernard
>
>_______________________________________________
>eclipselink-users mailing list
>eclipselink-users@xxxxxxxxxxx
>https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>



Back to the top