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

EntityManager.getDelegate should throw an IllegalStateException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.9.7
    • None
    • None

    Description

      EntityManager.getDelegate() should throw an IllegalStateException if the EntityManager has been closed.

      I noticed then when debugging other problems. According to the javadoc http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getDelegate() we need to throw an exception if the EM has been closed.

      In case I missed anything here's what I did to reproduce the problem.

      EntityManagerFactory _emf = Persistence.createEntityManagerFactory("test");

      EntityManager em = _emf.createEntityManager();

      em.close();

      try

      { Object o = em.getDelegate(); fail(); }

      catch(IllegalStateException ise)

      { System.out.println("Caught expected exception"); }

      Attachments

        1. openjpa-116-patch.txt
          1.0 kB
          Michael Dick

        Activity

          People

            kwsutter Kevin W. Sutter
            mikedd Michael Dick
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: