Simple Long ID entity en.persist() fails with "IllegalArgumentException: Can not set java.lang.Long field to entity"

Description

The test is simple. User a bytecode-enhanced runner and try to persist() a simple entity having a Long ID as PK:

Ship entity:

This fails with:

I'd expect this to be persisted without any problems. Note that this only occurrs when using the `@RunWith( BytecodeEnhancerRunner.class )`.

What's wrong?

NOTE:

I had a very similar test case in https://hibernate.atlassian.net/browse/HHH-14546 (PR: https://github.com/hibernate/hibernate-orm/pull/3896) for 5.4.x recently, where this did not happen. It seems like the fix is already somewhere in the 5.3 and/or 5.4 branches, but I couldn't find the issue.

Environment

Hibernate ORM test suite

Assignee

Unassigned

Reporter

Ka Wu

backPortable

Backport?