OpenJPA
  1. OpenJPA
  2. OPENJPA-1570

Exception using @Strategy in @MappedSuperclass or @Embeddable classes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta2
    • Fix Version/s: 2.0.0-beta3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 9.10, Maven 2.2.1, Spring 3.0.1

      Description

      An exception occurs if you add the @Strategy annotation on a field of an @Embeddable or @MappedSuperclass (not part of an @ElementCollection).
      The patch OPENJPA-1556.patch does not fix the problem.

      <openjpa-2.0.0-beta2-rexportiert fatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to map "jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is not mapped.

      To be more concrete. I try to change the default enum handling using an own EnumValueHandler. The Handler is working if you add
      the @Strategy to the @Entity. Adding @Strategy on a field in a @MappedSuperclass leads to the above exception.

      @javax.persistence.Entity
      @javax.persistence.Table(name = "TESTENTITY")
      public class TestEntity extends TestEntityBase

      { ... }

      @MappedSuperclass
      public abstract class TestEntityBase

      { @Column(name = "TESTENUMSIMPLE") @Enumerated(javax.persistence.EnumType.STRING) @Strategy("jpa.test.domain.EnumStrategy") private TestEnumSimple testEnumSimple; ... }

      You get the same Exception if you add the @Strategy to a @Embeddable and I also tried a own simple StringValueHandler with the same result.

      1. openjpa1570.tar
        6 kB
        Oliver Ringel

        Issue Links

          Activity

          Donald Woods made changes -
          Fix Version/s 2.0.0-beta3 [ 12314857 ]
          Fix Version/s 2.0.0 [ 12314019 ]
          Fay Wang made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Fay Wang made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Jerry Carter made changes -
          Link This issue is related to OPENJPA-1574 [ OPENJPA-1574 ]
          Donald Woods made changes -
          Assignee Fay Wang [ faywang ]
          Fix Version/s 2.0.0 [ 12314019 ]
          Oliver Ringel made changes -
          Attachment openjpa1570.tar [ 12438696 ]
          Oliver Ringel made changes -
          Summary Exception using @Strategy in @MappedSuperclass @Embeddable classes Exception using @Strategy in @MappedSuperclass or @Embeddable classes
          Description the same exception occurs if you add the @Strategy annotation on a field of an @Embeddable or @MappedSuperclass (not part of an @ElementCollection).
          The attached patch does not fix the problem.

          <openjpa-2.0.0-beta2-rexportiert fatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to map "jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is not mapped.

          To be more concrete. I try to change the default enum handling using an own EnumValueHandler. The Handler is working if you add
          the @Strategy to the @Entity. Adding @Strategy on a field in a @MappedSuperclass leads to the above exception.

          @javax.persistence.Entity
          @javax.persistence.Table(name = "TESTENTITY")
          public class TestEntity extends TestEntityBase {
          ...
          }

          @MappedSuperclass
          public abstract class TestEntityBase {
              @Column(name = "TESTENUMSIMPLE")
              @Enumerated(javax.persistence.EnumType.STRING)
              @Strategy("jpa.test.domain.EnumStrategy")
              private TestEnumSimple testEnumSimple;
          ...
          }

          You get the same Exception if you add the @Strategy to a @Embeddable and I also tried a own simple StringValueHandler with the same result.
          An exception occurs if you add the @Strategy annotation on a field of an @Embeddable or @MappedSuperclass (not part of an @ElementCollection).
          The patch OPENJPA-1556.patch does not fix the problem.

          <openjpa-2.0.0-beta2-rexportiert fatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to map "jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is not mapped.

          To be more concrete. I try to change the default enum handling using an own EnumValueHandler. The Handler is working if you add
          the @Strategy to the @Entity. Adding @Strategy on a field in a @MappedSuperclass leads to the above exception.

          @javax.persistence.Entity
          @javax.persistence.Table(name = "TESTENTITY")
          public class TestEntity extends TestEntityBase {
          ...
          }

          @MappedSuperclass
          public abstract class TestEntityBase {
              @Column(name = "TESTENUMSIMPLE")
              @Enumerated(javax.persistence.EnumType.STRING)
              @Strategy("jpa.test.domain.EnumStrategy")
              private TestEnumSimple testEnumSimple;
          ...
          }

          You get the same Exception if you add the @Strategy to a @Embeddable and I also tried a own simple StringValueHandler with the same result.
          Oliver Ringel made changes -
          Field Original Value New Value
          Link This issue is related to OPENJPA-1556 [ OPENJPA-1556 ]
          Oliver Ringel created issue -

            People

            • Assignee:
              Fay Wang
              Reporter:
              Oliver Ringel
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development