[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4570) Session.load(Class, id) fails with MappingException if entity names mapped

Jeremy Stone (JIRA) noreply at atlassian.com
Fri Nov 13 07:33:08 EST 2009


Session.load(Class, id) fails with MappingException if entity names mapped
--------------------------------------------------------------------------

                 Key: HHH-4570
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4570
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.SP1
         Environment: Windows XP
            Reporter: Jeremy Stone
         Attachments: testcase.zip

If map an entity with entity-name Session.load(Class clazz, Serializable id) fails with MappingException:

org.hibernate.MappingException: Unknown entity: test.AImpl
	at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)
	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
	at org.hibernate.impl.SessionImpl.load(SessionImpl.java:822)
	at org.hibernate.impl.SessionImpl.load(SessionImpl.java:815)
...

load(String entityName, Serializable id) works though.

It also appears inconsistent with e.g. Session.createCriteria(...) which, in its various forms, works for entity names, class names or classes. (On a separate note, the entity name override of createCriteria can be slow as a result of its reliance on a thrown ClassNotFoundException (at least with the locking behaviour of the JBoss RepositoryClassLoader)).

A simple test case is attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list