Make EntityPrinter more permissive regarding the parameters passed

Description

In some cases, in trace log level, EntityPrinter might be called with an entity name not consistent with the passed object.

This can happen for instance here:
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/test/java/org/hibernate/test/naturalid/inheritance/cache/InheritedNaturalIdCacheTest.java#L65

It's just a test but it could also happen in an application doing the wrong thing, which is probably when you will try to use the trace log level.

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Guillaume Smet

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure