{"record":{"id":"84c60ec33371d1ee","repo":"hibernate/hibernate-orm","slug":"could-not-build-explicit-batchbuilder-buildercla","errorCode":null,"errorMessage":"Could not build explicit BatchBuilder [{builderClassName}]","messagePattern":"Could not build explicit BatchBuilder \\[(.+?)\\]","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java","lineNumber":67,"sourceCode":"\t\t\tfinal var discovered = discover( classLoaderService );\n\t\t\treturn discovered != null\n\t\t\t\t\t? discovered\n\t\t\t\t\t: new BatchBuilderImpl( getInt( STATEMENT_BATCH_SIZE, configurationValues, 1 ) );\n\t\t}\n\t\telse if ( builder instanceof BatchBuilder batchBuilder ) {\n\t\t\treturn batchBuilder;\n\t\t}\n\t\telse {\n\t\t\tfinal String builderClassName = builder.toString();\n\t\t\ttry {\n\t\t\t\treturn (BatchBuilder)\n\t\t\t\t\t\tclassLoaderService\n\t\t\t\t\t\t\t\t.classForName( builderClassName )\n\t\t\t\t\t\t\t\t.getConstructor()\n\t\t\t\t\t\t\t\t.newInstance();\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new ServiceException( \"Could not build explicit BatchBuilder [\" + builderClassName + \"]\", e );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static BatchBuilder discover(ClassLoaderService classLoaderService) {\n\t\tfinal var discovered = classLoaderService.loadJavaServices( BatchBuilder.class );\n\t\tfinal var iterator = discovered.iterator();\n\t\tif ( iterator.hasNext() ) {\n\t\t\tfinal var selected = iterator.next();\n\t\t\tif ( iterator.hasNext() ) {\n\t\t\t\tthrow new ServiceException(\n\t\t\t\t\t\t\"Multiple BatchBuilder service registrations found via ServiceLoader; \"\n\t\t\t\t\t\t+ \"specify one explicitly via '\" + BUILDER + \"'\" );\n\t\t\t}\n\t\t\treturn selected;\n\t\t}\n\t\telse {\n\t\t\treturn null;","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java#L49-L85","documentation":"Error \"Could not build explicit BatchBuilder [{builderClassName}]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchBuilderInitiator.java:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the BatchBuilder class configured via 'hibernate.jdbc.batch.builder' has a suitable constructor and is on the classpath","Remove the custom setting to fall back to the default BatchBuilder"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}