OpenJPA
  1. OpenJPA
  2. OPENJPA-873

@MappedSuperClass Cause Null Pointer Exception in Class With IdClass

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.0.4, 1.2.2, 1.3.0, 2.0.0-M2
    • Component/s: None
    • Labels:
      None

      Description

      This JIRA is open on behalf of pioneer_ip@yahoo.com.

      @MappedSuperclass
      public abstract class CashBaseEntity extends BaseEntity

      { @Column(name="TRCCRUI") private String createUser; @Column(name="TRCCRTS") private Date createTime; @Column(name="TRCLUUID") private String updateUser; @Column(name="TRCLUTS") private Date updateTime; @Version @Column(name="TRCVER") private int version; //getter setter ....removed ..for short post }

      @Entity
      @Table ( name = "cc2SITUATION")
      @IdClass(SituationDA.SituationId.class)
      public class SituationDA extends CashBaseEntity{

      @Id
      @Column(name="C2008SRL")
      private String CashBoxPeriodSerial;

      @Id
      @Column(name="C2012TYPE")
      private short Type;

      public static class SituationId implements Serializable{
      private static final long serialVersionUID = 1L;
      public String CashBoxPeriodSerial;
      public short Type;

      public SituationId(){

      }

      public boolean equals(Object other){
      if (other instanceof SituationId)

      { final SituationId otherId = (SituationId)other; return ( otherId.CashBoxPeriodSerial.equals(this.CashBoxPeriodSerial) && otherId.Type == this.Type ); }

      return false;
      }

      public int hashCode()

      { return super.hashCode(); }

      }
      //getter setter removed for short post..
      }

      @Entity
      @Table (name = "CF2VLUITEM")
      public class ValuableItemDA extends CashBaseEntity

      { @Id @Column(name="C2001COD") private short Code; //getter setter removed for short post.. }

      Exception in thread "main" java.lang.NullPointerException
      at org.apache.openjpa.meta.ClassMetaData.validateAppIdClass(ClassMetaData.java:1883)
      at org.apache.openjpa.meta.ClassMetaData.validateIdentity(ClassMetaData.java:1840)
      at org.apache.openjpa.meta.ClassMetaData.validateMeta(ClassMetaData.java:1757)
      at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1630)
      at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717)
      at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:616)
      at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
      at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
      at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:249)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4502)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4449)
      at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4419)
      at org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:726)
      at org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:716)
      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4414)
      at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4405)

      1. OPENJPA-873_1.0.x.patch
        14 kB
        Jody Grassel
      2. OPENJPA-873_1.2.x.patch
        15 kB
        Jody Grassel

        Activity

        Hide
        Fay Wang added a comment -

        fix is commited r737814 (openjpa-1.3.x) and r737816 (openjpa trunk).

        Show
        Fay Wang added a comment - fix is commited r737814 (openjpa-1.3.x) and r737816 (openjpa trunk).
        Hide
        Michael Dick added a comment -

        Reopening. Testcase needed.

        Show
        Michael Dick added a comment - Reopening. Testcase needed.
        Hide
        Fay Wang added a comment -

        Test cases are checked into trunk r-740802, and openjpa1.3.x r-740804.

        Show
        Fay Wang added a comment - Test cases are checked into trunk r-740802, and openjpa1.3.x r-740804.
        Hide
        Jody Grassel added a comment -

        Patch for OpenJPA 1.0.x

        Show
        Jody Grassel added a comment - Patch for OpenJPA 1.0.x
        Hide
        Jody Grassel added a comment -

        Patch for OpenJPA 1.2.x.

        Show
        Jody Grassel added a comment - Patch for OpenJPA 1.2.x.
        Hide
        Michael Dick added a comment -

        Applied patches for 1.0.x and 1.2.x.

        Show
        Michael Dick added a comment - Applied patches for 1.0.x and 1.2.x.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development