Entity loads eagerly when it should be lazy

No, I haven’t enabled that setting.

I will try to show you how it behaves. So my test is basically this:

private Employee someAccess(boolean traverse) {
        Session sess;
        Transaction tx = null;
        Long daveId = createObjectGraph(true);
        try {
            sess = openSession();
            tx = sess.beginTransaction();
            Employee dave = (Employee) sess.load(Employee.class, daveId);
            dave.getName();
            if (traverse) {
                dave.getSupervisor().getName();
                dave.getMentor().getName();
                dave.getSupervisor().getSupervisor().getName();
                dave.getSupervisor().getSupervisor().getSubordinates().size();
            }
            tx.commit();
            tx = null;
            return dave;
        } finally {
            if (tx != null) {
                tx.rollback();
            }
            session.close();
        }
    }
    @Test
    public void testLoadFetchProfile() {
        em.clearExtentInformation();

        // Execute query multiple times
//        someAccess(true);
        Employee dave = someAccess(true);

        // These all should not throw lazy instantiation exception, because
        // they should have been fetch eagerly
        dave.getSupervisor().getName();
        dave.getSupervisor().getSupervisor().getName();
        dave.getSupervisor().getSupervisor().getSubordinates().size();
        dave.getMentor().getName();

        // This should throw a lazy instantiation exception
        try {
            dave.getSupervisor().getSupervisor().getSupervisor().getSubordinates();
            // Shouldn't get here
            Assert.fail("Lazy instantion exception not thrown for a property which shouldn't have been fetched");
        } catch (LazyInitializationException e) {
            // Good
        }
    }

variables

As you can see, I traverse some of the entities I created. However, the line dave.getSupervisor().getSupervisor().getSupervisor().getSubordinates() should throw LazyInitializationException since it’s subordinates is a lazy association. Also notice that the variables show that the proxy is completely empty (I am debugging with the debug-pointer at line dave.getSupervisor().getSupervisor().getSupervisor().getSubordinates()). So all in all, session is null, the proxy doesn’t have any values set, but the target has all the values set (is this correct?). I do get a com.sun.jdi.InvocationException when observing the value for associations that uses my custom wrapper set in the debugging view, but I have heard that is only a problem with the toString() method and when debugging.

variables2