HHH-17494 Metamodel generator produce an uncompilable class when an EntityGraph name contains a comma

This commit is contained in:
Réda Housni Alaoui 2023-12-01 19:20:30 +01:00 committed by Christian Beikov
parent ee43bb51b9
commit 1d956eb400
2 changed files with 6 additions and 1 deletions

View File

@ -99,7 +99,7 @@ public final class StringUtil {
} }
public static String nameToMethodName(String name) { public static String nameToMethodName(String name) {
return name.replaceAll("[\\s.\\-!@#%=+/*^&|(){}\\[\\]]", "_"); return name.replaceAll("[\\s.\\-!@#%=+/*^&|(){}\\[\\],]", "_");
} }
public static String getUpperUnderscoreCaseFromLowerCamelCase(String lowerCamelCaseString){ public static String getUpperUnderscoreCaseFromLowerCamelCase(String lowerCamelCaseString){

View File

@ -41,4 +41,9 @@ public class StringUtilTest {
public void testGetUpperUnderscoreCaseFromLowerCamelCase(){ public void testGetUpperUnderscoreCaseFromLowerCamelCase(){
assertEquals("USER_PARENT_NAME", StringUtil.getUpperUnderscoreCaseFromLowerCamelCase("userParentName")); assertEquals("USER_PARENT_NAME", StringUtil.getUpperUnderscoreCaseFromLowerCamelCase("userParentName"));
} }
@Test
public void testNameToMethodNameWithComma() {
assertEquals( "entity_Graph", StringUtil.nameToMethodName( "entity,Graph" ) );
}
} }