Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1541

Support Enum as Primary Key Type

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 2.0.0-beta
    • None
    • competitive, jpa
    • None
    • All

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bht@actrix.gen.nz bernard
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: