{"record":{"id":"8bb5fdbbc27a4f01","repo":"hibernate/hibernate-orm","slug":"unable-to-copy-stream-content","errorCode":null,"errorMessage":"Unable to copy stream content","messagePattern":"Unable to copy stream content","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java","lineNumber":2020,"sourceCode":"\n\t/**\n\t * A {@link LobMergeStrategy} based on transferring contents using streams.\n\t */\n\t@SuppressWarnings(\"unused\")\n\tprotected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY = new LobMergeStrategy() {\n\t\t@Override\n\t\tpublic Blob mergeBlob(Blob original, Blob target, SharedSessionContractImplementor session) {\n\t\t\tif ( original != target ) {\n\t\t\t\ttry {\n\t\t\t\t\t// the BLOB just read during the load phase of merge\n\t\t\t\t\tfinal var connectedStream = target.setBinaryStream( 1L );\n\t\t\t\t\t// the BLOB from the detached state\n\t\t\t\t\tfinal var detachedStream = original.getBinaryStream();\n\t\t\t\t\tdetachedStream.transferTo( connectedStream );\n\t\t\t\t\treturn target;\n\t\t\t\t}\n\t\t\t\tcatch (IOException e ) {\n\t\t\t\t\tthrow new HibernateException( \"Unable to copy stream content\", e );\n\t\t\t\t}\n\t\t\t\tcatch (SQLException e ) {\n\t\t\t\t\tthrow session.getFactory().getJdbcServices().getSqlExceptionHelper()\n\t\t\t\t\t\t\t.convert( e, \"unable to merge BLOB data\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn NEW_LOCATOR_LOB_MERGE_STRATEGY.mergeBlob( original, target, session );\n\t\t\t}\n\t\t}\n\n\t\t@Override\n\t\tpublic Clob mergeClob(Clob original, Clob target, SharedSessionContractImplementor session) {\n\t\t\tif ( original != target ) {\n\t\t\t\ttry {\n\t\t\t\t\t// the CLOB just read during the load phase of merge\n\t\t\t\t\tfinal var connectedStream = target.setAsciiStream( 1L );\n\t\t\t\t\t// the CLOB from the detached state","sourceCodeStart":2002,"sourceCodeEnd":2038,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java#L2002-L2038","documentation":"Error \"Unable to copy stream content\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A dialect-specific function or stream operation is used that the current database dialect does not support.","commonSituations":"Calling timestampadd()/timestampdiff() on dialects lacking support, or LOB stream handling hitting IO failures.","solutions":["Check the underlying IOException cause (stream closed early, network failure) and retry with a valid readable stream."],"exampleFix":"Check the underlying IOException cause (stream closed early, network failure) and retry with a valid readable stream.","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"}