{"record":{"id":"d3145a1acf210c22","repo":"hibernate/hibernate-orm","slug":"operation-not-supported-s-remove","errorCode":null,"errorMessage":"Operation not supported: %s.remove()","messagePattern":"Operation not supported: (.+?)\\.remove\\(\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/event/spi/MergeContext.java","lineNumber":291,"sourceCode":"\t * @param map keys and values must be non-null\n\t * @throws NullPointerException if any key or value is null\n\t * @throws IllegalArgumentException if a key in <code>map</code> was already in this MergeContext\n\t * but associated value in <code>map</code> is different from the previous value in this MergeContext.\n\t * @throws IllegalStateException if internal cross-references are out of sync,\n\t */\n\tpublic void putAll(@Nonnull Map<?,?> map) {\n\t\tfor ( var entry : map.entrySet() ) {\n\t\t\tput( entry.getKey(), entry.getValue() );\n\t\t}\n\t}\n\n\t/**\n\t * The remove operation is not supported.\n\t * @param mergeEntity the merge entity.\n\t * @throws UnsupportedOperationException if called.\n\t */\n\tpublic @Nullable Object remove(@Nonnull Object mergeEntity) {\n\t\tthrow new UnsupportedOperationException(\n\t\t\t\tString.format( \"Operation not supported: %s.remove()\", getClass().getName() )\n\t\t);\n\t}\n\n\t/**\n\t * Returns the number of merge-to-managed entity cross-references in this MergeContext\n\t * @return the number of merge-to-managed entity cross-references in this MergeContext\n\t */\n\tpublic int size() {\n\t\treturn mergeToManagedEntityXref.size();\n\t}\n\n\t/**\n\t * Returns an unmodifiable Set view of managed entities contained in this MergeContext.\n\t * @return an unmodifiable Set view of managed entities contained in this MergeContext\n\t *\n\t * @see Collections#unmodifiableSet(Set)\n\t */","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/event/spi/MergeContext.java#L273-L309","documentation":"Error \"Operation not supported: %s.remove()\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when remove() is called on a MergeContext entry set/iterator, which is a read-only view.","commonSituations":"Typical situations: code iterating the merge map attempting to delete entries; framework-extension code misusing the MergeContext API.","solutions":["Do not call remove() on the merge context entry set iterator; this operation is unsupported by design."],"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"}