Avoid initializing proxy when using covariant return types for ID getters

Description

When using an entity hierarchy with overridden ID getters and covariant return types, Hibernate does not detect ID getter calls and unnecessarily initializes proxies in order to call the methods instead of just returing the ID.

Environment

None

Activity

Show:
Eugene Goroschenya
February 16, 2013, 2:21 AM
Eugene Goroschenya
February 18, 2013, 4:38 AM

would you please provide a test case?

Test case and fix patches have been attached to https://hibernate.onjira.com/browse/HHH-3502

Steve Ebersole
October 28, 2015, 6:15 AM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Steve Ebersole
October 28, 2015, 2:25 PM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Gallyam Biktashev
January 22, 2020, 9:18 PM
Edited

Hey, guys! I’m still faced that on Hibernate 5.4.10.Final. I’ve had an

and implementation

But when I load entity via session.load() and call to entity.getId(), it still makes a request to database

The workaround for this is to declare id like this

 

Assignee

Strong Liu

Reporter

Michael Rudolf

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major