JavassistLazyInitializer throws PropertyAccessException when super class setter method is overloaded

Description

After upgrading from version 3.2.6 to version 3.3.2 I came across a situation where hibernate throws an exception (if using Javassist bytecode provider). I am registering this as a bug type issue and would very much appreciate your kind input on this subject.

Please find attached a testcase for the hibernate-testsuite module that demonstrates this issue.

The exception is thrown because the lazy initialization proxy is not able to find a setter method of a domain.
It does not find the setter method because the domain is composed of an abstract class and a concrete class, which I shall refer to as AbstractOverloaded and Overloaded, respectively.

AbstractOverloaded defines the setter method "public void setName(String name)" which receives a parameter of type String as defined in the mapping.
Overloaded extends AbstractOverloaded and defines the method "public void setName(Integer name)" which overloads the previous method.

When the JavassistLazyInitializer loads an instance of Overloaded, the proxy returned throws an exception if you try to execute the statement overloadedProxy.setName("Manuel"), because it cannot find the method defined in the AbstractOverloaded (super class) class.
On the other hand, when you create a proxy of the Overloaded class by using javassist directly then the same statement overloadedProxy.setName("Manuel") works well.

I am aware that I could configure hibernate to use the CGLIB bytecode provider instead, which would prevent the exception from occurring. However since Hibernate adopted Javassist as their bytecode provider of choice and I prefer to stick to your standards and not deviate from the recomended dependencies.

I look forward to your recomendations.

Kind regards
Martins

Environment

Verified in hibernate-core version 3.3.1, .3.3.2 and 3.3.3-SNAPSHOT

Activity

Show:
Brett Meyer
April 7, 2014, 5:43 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

Brett Meyer
July 8, 2014, 3:11 PM

Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!

Assignee

Unassigned

Reporter

Carlos Martins

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