HHH-13097 Don't throw an exception if there are two getter candidates

This commit is contained in:
Guillaume Smet 2018-11-13 20:26:33 +01:00 committed by Sanne Grinovero
parent 36078065ea
commit 79a8f43ba5
1 changed files with 4 additions and 9 deletions

View File

@ -104,15 +104,10 @@ class ByteBuddyEnhancementContext {
if ( getCandidate != null ) {
if ( isCandidate != null ) {
throw new MappingException(
String.format(
Locale.ROOT,
"In trying to locate getter for property [%s], Class [%s] defined " +
"both a `get` [%s] and `is` [%s] variant",
fieldDescription.getName(),
fieldDescription.getDeclaringType().getActualName(),
getCandidate.getActualName(),
isCandidate.getActualName() ) );
// if there are two candidates, the existing code considered there was no getter.
// not sure it's such a good idea but throwing an exception apparently throws exception
// in cases where Hibernate does not usually throw a mapping error.
return Optional.empty();
}
return Optional.of( getCandidate );