We're updating the issue view to help you get more done. 

SessionImpl.refresh() throws IllegalArgumentException, "not an Entity" when using custom entity name

Description

We have some entities where we use a custom entity-name, other than the class name.
Before version 5.2 we were able to call SessionImpl.refresh() with the entity name and the entity:

1 session.refresh(“CustomName”, obj)

After some research, I found a possible cause for this behavior.
Since 5.2.0, there are two implementations of the SessionImpl.contains() method.
One without and one with an additional parameter for the entity name.
And the DefaultRefreshEventListener is using the one with the object only.
Therefore, the given entity name is no longer used.

I have attached a simple test case to reproduce this error.

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Bjoern Steckelbach

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.2
5.2.0
5.2.3
5.2.4
5.2.1

Priority

Major