{"record":{"id":"956f208f2c29523e","repo":"hibernate/hibernate-orm","slug":"could-not-determine-how-to-handle-configuration-va-956f20","errorCode":null,"errorMessage":"Could not determine how to handle configuration value [name=${name}, value=${value}(${value.getClass().getName()})] as Integer","messagePattern":"Could not determine how to handle configuration value \\[name=(.+?), value=(.+?)\\((.+?)\\)\\] as Integer","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java","lineNumber":223,"sourceCode":"\t * @param name The config setting name.\n\t * @param values The map of config values\n\t *\n\t * @return The value, or null if not found\n\t */\n\tpublic static Integer getInteger(String name, Map<?,?> values) {\n\t\tfinal Object value = values.get( name );\n\t\tif ( value == null ) {\n\t\t\treturn null;\n\t\t}\n\t\telse if (value instanceof Integer integer) {\n\t\t\treturn integer;\n\t\t}\n\t\telse if (value instanceof String string) {\n\t\t\t//empty values are ignored\n\t\t\tfinal String trimmed = string.trim();\n\t\t\treturn trimmed.isEmpty() ? null : Integer.valueOf( trimmed );\n\t\t}\n\t\tthrow new ConfigurationException(\n\t\t\t\t\"Could not determine how to handle configuration value [name=\" + name +\n\t\t\t\t\t\t\", value=\" + value + \"(\" + value.getClass().getName() + \")] as Integer\"\n\t\t);\n\t}\n\n\tpublic static long getLong(String name, Map<?,?> values, int defaultValue) {\n\t\tfinal Object value = values.get( name );\n\t\tif ( value == null ) {\n\t\t\treturn defaultValue;\n\t\t}\n\t\telse if (value instanceof Long number) {\n\t\t\treturn number;\n\t\t}\n\t\telse if (value instanceof String string) {\n\t\t\treturn Long.parseLong(string);\n\t\t}\n\t\telse {\n\t\t\tthrow new ConfigurationException(","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/util/config/ConfigurationHelper.java#L205-L241","documentation":"The nullable variant ConfigurationHelper.getInteger accepts null, Integer, or String values; blank/whitespace-only strings are trimmed and returned as null (empty values are ignored). Any other runtime type under the key (Long, Boolean, Double, custom object) throws this ConfigurationException. As with getInt, the message identifies the key, raw value, and concrete value class.","triggerScenarios":"Putting a non-Integer, non-String object under a key that Hibernate later reads with getInteger, e.g. props.put(\"some.int.setting\", Boolean.TRUE) or a Double from a typed config bridge; a Long literal autoboxed from code like props.put(key, 100L).","commonSituations":"Typed config frameworks (Spring Environment adapters, microprofile config) feeding the JPA integration map; integration tests that set flags as Boolean for keys Hibernate treats as Integer; mixed-type maps assembled from several sources.","solutions":["Put the value as an Integer or as a numeric String; use an empty/blank string when you want the setting treated as absent (returns null)","Normalize values from typed sources with String.valueOf(...) before they enter the map","Check the message for name=<key> and the value class, then fix or remove that single entry"],"exampleFix":"// before\nObject v = typedConfigSource.get(\"some.int.setting\"); // may arrive as Long/Boolean\nprops.put(\"some.int.setting\", v);\n\n// after\nObject v = typedConfigSource.get(\"some.int.setting\");\nprops.put(\"some.int.setting\",\n        v instanceof Integer || v instanceof String ? v : String.valueOf(v));","handlingStrategy":"validation","validationCode":"for (Map.Entry<String,Object> e : props.entrySet()) {\n    Object v = e.getValue();\n    if (!(v == null || v instanceof Integer || v instanceof String)) {\n        e.setValue(String.valueOf(v));\n    }\n}","typeGuard":"static boolean isIntegerCoercible(Object v) {\n    if (v == null || v instanceof Integer) return true;\n    if (v instanceof String s) {\n        String t = s.trim();\n        return t.isEmpty() || t.chars().allMatch(c -> c == '-' || Character.isDigit(c));\n    }\n    return false;\n}","tryCatchPattern":null,"preventionTips":["Keep Integer-typed settings as Integer or numeric String; blank strings intentionally mean 'absent'","Do not reuse Boolean values for Integer-typed keys","Validate the config map once at application start"],"tags":["configuration","type-conversion","bootstrap"],"backgroundTag":"invalid-config-value","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}