OpenJPA
  1. OpenJPA
  2. OPENJPA-1890

NPE is thrown when an Embeddable object is set more than once to a managed entity

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2, 2.1.0
    • Component/s: None
    • Labels:
      None

      Description

      java.lang.NullPointerException
      at org.apache.openjpa.kernel.SingleFieldManager.dereferenceEmbedDependent(SingleFieldManager.java:432)
      at org.apache.openjpa.kernel.SingleFieldManager.delete(SingleFieldManager.java:317)
      at org.apache.openjpa.kernel.SingleFieldManager.dereferenceDependent(SingleFieldManager.java:294)
      at org.apache.openjpa.kernel.StateManagerImpl.settingObjectField(StateManagerImpl.java:2031)
      at embeddable.Department.pcSetdepartmentEmbeddable(Department.java)
      at embeddable.Department.setDepartmentEmbeddable(Department.java:62)
      at embeddable.TestEmbeddable.testFind(TestEmbeddable.java:52)

      where:

      private DepartmentEmbeddable makeEmbeddable()

      { DepartmentEmbeddable d1 = new DepartmentEmbeddable(); d1.setDeptname("name"); d1.setMgrno("qw"); return d1; }

      @Override
      public void test()

      { Department d = em.find(Department.class, "1"); DepartmentEmbeddable d2 = new DepartmentEmbeddable(); d.setDepartmentEmbeddable(makeEmbeddable()); d.setDepartmentEmbeddable(makeEmbeddable()); <== NPE is thrown }

        Activity

        Hide
        Michael Dick added a comment -

        If there's more work to be done for this issue please re-open, or open a sub task for the remaining work.

        Show
        Michael Dick added a comment - If there's more work to be done for this issue please re-open, or open a sub task for the remaining work.
        Hide
        Michael Dick added a comment -

        reopening to target for 2.0.2

        Show
        Michael Dick added a comment - reopening to target for 2.0.2

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development