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

get java.lang.ClassCastException when IdClass contains an Enum Field

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M2
    • 2.0.0-M3
    • kernel
    • None

    Description

      Suppose EntityA and EntityB are defined as follows:

      @Entity
      class EntityA {
      @Id
      int id;

      @OneToOne(fetch=fetchType=LAZE)
      EntityB entityB;

      ...
      }

      @Entity
      @IdClass(BId.class)
      class EntityB {

      @Id
      int intId;

      @Id
      BType bType;
      ...

      public enum BType

      { A1, A2, A3, A4 }

      ;
      ...
      }

      ClassCast Exception is thrown in the following situation:

      EntityA a = em.find(EntityA.class, 1)
      EntityB b = a.getEntityB();

      Attachments

        Activity

          People

            faywang Fay Wang
            faywang Fay Wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: