Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Problem with Bean Mapping Style due to Type Erasure #457
When using Bean MappingStyle (using @id on getters), an issue is being encountered with the use of the @id annotation on an extended generic method. This results in an ENTITY_WITHOUT_ID Exception ("Class '%s' mapped as Entity has no Id property. Use @id annotation to mark unique and not-null Entity identifier") being thrown.
This can be easily replicated when we have an abstract Parent class that defines a getter method which is overridden by a child class getter annotated with @id. Example:
Due to type erasure and generated bridge method (https://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html), the following methods will be generated:
In JaversMethodFactory.getAllMethods(), sometimes this method processes the 'bridge' method first, before our method, and this results in our method to be skipped since the logic filters inheritance duplicates. A suggested solution is to skip the bridge method, thus our method can be added.
PR with failing test case and proposed solution will be pushed soon.