| An entityManager.find() wouldn't help, since it will just return the same proxy – at least in the same session – that's part of the problem (unless I've misunderstood your suggestion). I suppose something that might be helpful for Hibernate to do would be to either log an error/warning or throw an exception in the case where a call find() follows a call to getReference() in a session for an Entity with an @Inheritance annotation results in a proxy of the wrong type. This way I know the way I'm using the session is the problem, not my mapping. Maybe "Previous call to getReference() has prevented find() return a proxy of the correct type" or something along those line. And/or perhaps an option to cause getReference() to do the minimal query where @Inheritance is present will return proxy of the correct type? |