{"record":{"id":"82ec0bc539728e4a","repo":"hibernate/hibernate-orm","slug":"all-join-columns-on-collection-role-should-hav","errorCode":null,"errorMessage":"All join columns on collection '<role>' should have the same insertable and updatable setting","messagePattern":"All join columns on collection '<role>' should have the same insertable and updatable setting","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":2732,"sourceCode":"\t\tcheckConsistentColumnMutability( collection.getRole(), collection.getElement() );\n\t}\n\n\tprivate static void checkConsistentColumnMutability(String collectionRole, Value value) {\n\t\tBoolean readOnly = null;\n\t\tfor ( int i = 0; i < value.getColumnSpan(); i++ ) {\n\t\t\tfinal boolean insertable = value.isColumnInsertable( i );\n\t\t\tif ( insertable != value.isColumnUpdateable( i ) ) {\n\t\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\t\"Join column '\" + value.getColumns().get( i ).getName() + \"' on collection property '\"\n\t\t\t\t\t\t\t\t+ collectionRole + \"' must be defined with the same insertable and updatable attributes\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( readOnly == null ) {\n\t\t\t\treadOnly = insertable;\n\t\t\t}\n\t\t\telse if ( readOnly != insertable && !value.getColumns().get( i ).isFormula() ) {\n\t\t\t\t// We also assert that all join columns have the same mutability (except formulas)\n\t\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\t\"All join columns on collection '\" + collectionRole + \"' should have\" +\n\t\t\t\t\t\t\t\t\" the same insertable and updatable setting\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void bindCollectionSecondPass(PersistentClass targetEntity, AnnotatedJoinColumns joinColumns) {\n\n\t\tif ( !isUnownedCollection() ) {\n\t\t\tcreateSyntheticPropertyReference(\n\t\t\t\t\tjoinColumns,\n\t\t\t\t\tcollection.getOwner(),\n\t\t\t\t\tcollection.getOwner(),\n\t\t\t\t\tcollection,\n\t\t\t\t\tpropertyName,\n\t\t\t\t\tfalse,\n\t\t\t\t\tbuildingContext","sourceCodeStart":2714,"sourceCodeEnd":2750,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L2714-L2750","documentation":"Error \"All join columns on collection '<role>' should have the same insertable and updatable setting\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A '@JoinColumn' / 'referencedColumnName' does not line up with the columns mapped by the target entity.","commonSituations":"Composite foreign keys, associations to entities with secondary tables, or reordered/duplicated referencedColumnName values across multiple @JoinColumn declarations.","solutions":["Align insertable and updatable settings across all join columns of the collection."],"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"}