"java.lang.IllegalArgumentException: Not an entity" while calling Session.contains() for hbm file based entity

Description

When Metamodel is created based on hbm xml file mapping then wrong entity name is set for MetamodelImpl#entityPersisterMap comparing with annotation based one.

Because of that it is impossible to get entity persister by its class for any entity that has configred entity-name in hbm xml file.

After all this one leads to nasty:

After deep debugging we found that in org.hibernate.boot.model.source.internal.hbm.ModelBinder which is responsible for creation of bindings based on hbm xml files entity-name xml attribute is assigned to PersistenceClass#entityName class mapping:

in opposite to org.hibernate.cfg.annotations.EntityBinder where a class name is assigned to PersistenceClass#entityName

 

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Łukasz Dęgus

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure