Details

    • Type: Test Test
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: 1.3.0, 2.0.0-M2
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      I have a piece of code that effectively does the same thing the following test does:

      private void newDeleteNew() throws Exception

      { beginTx(); // Create new Person dain = new Person(); dain.setName("dain"); assertFalse(entityManager.contains(dain)); entityManager.persist(dain); entityManager.flush(); assertTrue(entityManager.contains(dain)); // Find and verify dain = entityManager.find(Person.class, "dain"); assertNotNull(dain); assertEquals("dain", dain.getName()); // Delete entityManager.remove(dain); entityManager.flush(); assertFalse(entityManager.contains(dain)); // Recreate dain = new Person(); dain.setName("dain"); assertFalse(entityManager.contains(dain)); entityManager.persist(dain); entityManager.flush(); assertTrue(entityManager.contains(dain)); // Find and verify dain = entityManager.find(Person.class, "dain"); assertNotNull(dain); // <<<<<<< FAILS assertEquals("dain", dain.getName()); commitTx(); }

      The test fails at the marked point, because the entityManager seems to think the "dain" entity is still deleted. I assume this type of code would work. Is this a bug or is my assumption wrong?

      BTW, I'm using 0.9.8-incubating-SNAPSHOT

      And here is my entity class:

      @Entity
      public class Person {
      private String name;

      @Id
      public String getName()

      { return name; }

      public void setName(String name)

      { this.name = name; }

      }

        Activity

        Hide
        B.J. Reed added a comment -

        I have tried re-creating this problem on trunk (2.0) and 1.2, so it looks like this has been fixed for a while. Please verify that this has been fixed in later versions and close this JIRA.

        Show
        B.J. Reed added a comment - I have tried re-creating this problem on trunk (2.0) and 1.2, so it looks like this has been fixed for a while. Please verify that this has been fixed in later versions and close this JIRA.
        Hide
        B.J. Reed added a comment -

        Patch contains a new test case for org.apache.openjpa.persistence.simple.TestPersistence that verifies that this is working properly now.

        Show
        B.J. Reed added a comment - Patch contains a new test case for org.apache.openjpa.persistence.simple.TestPersistence that verifies that this is working properly now.
        Hide
        Donald Woods added a comment -

        reopening so we can add the testcase from BJ that proves this has been fixed

        Show
        Donald Woods added a comment - reopening so we can add the testcase from BJ that proves this has been fixed
        Hide
        Donald Woods added a comment -

        applied testcase showing that this failure no longer exists to 1.3.x and trunk
        Thanks BJ for the testcase patch.

        Show
        Donald Woods added a comment - applied testcase showing that this failure no longer exists to 1.3.x and trunk Thanks BJ for the testcase patch.

          People

          • Assignee:
            Donald Woods
            Reporter:
            Dain Sundstrom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development