Issue Details (XML | Word | Printable)

Key: OPENJPA-116
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Kevin Sutter
Reporter: Michael Dick
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenJPA

EntityManager.getDelegate should throw an IllegalStateException

Created: 29/Jan/07 10:28 PM   Updated: 17/Apr/07 06:38 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 0.9.7

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works openjpa-116-patch.txt 2007-01-30 03:54 PM Michael Dick 1.0 kB

Resolution Date: 30/Jan/07 07:45 PM


 Description  « Hide
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");
        }



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kevin Sutter added a comment - 30/Jan/07 07:45 PM
This issue was temporarily resolved with the patch that Mike provided. Abe has since changed the processing in this area of the code and, thus, the actual call to assertOpen() has been replaced with the assertNotCloseInvoked() method, but the same result still happens.