diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java index be5a0caacc..fd4ab26ba8 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java @@ -39,7 +39,7 @@ import org.hibernate.type.Type; public final class ReflectHelper { private static final Pattern JAVA_CONSTANT_PATTERN = Pattern.compile( - "[a-z\\d]+\\.([A-Z]{1}[a-z\\d]+)+\\$?([A-Z]{1}[a-z\\d]+)*\\.[A-Z_\\$]+", Pattern.UNICODE_CHARACTER_CLASS); + "[a-z\\d]+\\.([A-Z]+[a-z\\d]+)+\\$?([A-Z]{1}[a-z\\d]+)*\\.[A-Z_\\$]+", Pattern.UNICODE_CHARACTER_CLASS); public static final Class[] NO_PARAM_SIGNATURE = new Class[0]; public static final Object[] NO_PARAMS = new Object[0]; diff --git a/hibernate-core/src/test/java/org/hibernate/internal/util/ReflectHelperTest.java b/hibernate-core/src/test/java/org/hibernate/internal/util/ReflectHelperTest.java index 78e914a910..b6559f39fb 100644 --- a/hibernate-core/src/test/java/org/hibernate/internal/util/ReflectHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/internal/util/ReflectHelperTest.java @@ -230,4 +230,15 @@ public class ReflectHelperTest { public void test_setMethod_nestedInterfaces_on_superclasses() { assertNotNull( ReflectHelper.findSetterMethod( E.class, "id", String.class ) ); } + + @TestForIssue(jiraKey = "HHH-14059") + @Test + public void test_getConstantValue_UpperCaseEnum() { + when( sessionFactoryOptionsMock.isConventionalJavaConstants() ).thenReturn( true ); + + when( classLoaderServiceMock.classForName( "com.example.UStatus" ) ).thenReturn( (Class) Status.class ); + Object value = ReflectHelper.getConstantValue( "com.example.UStatus.OFF", sessionFactoryImplementorMock); + assertEquals( OFF, value ); + verify(classLoaderServiceMock, times(1)).classForName( eq("com.example.UStatus") ); + } } \ No newline at end of file