Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-19628

When using composite keys enums don't properly use their convertor.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • JPA / Hibernate
    • None
    • ---
    • ---

      Expected:

      1. Define an enum with explicit integer constants.
        ie. enum Stage { Entered(1); int value; public Stage(int value) { this.value = value }

        ... }

      2. Add an {enum}Convertor java class decoratored with @Convertor for the enum and autoApply=true.
      3. Use the enum as part of an @IdClass for a composite key.
      4. I'd expect the stage column to store the value 1 in the database for Stage.Entered.

       

      Actual Result:

      1. The first ordinal enum value is given value 0 because it is the first enum constant.

       

      Other Observations:

      1. This works fine if it is just a regular old column and not part of a compose key.

              smarlow1@redhat.com Scott Marlow
              vbn_cio Patrick Bakker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: