{"record":{"id":"b208698870cb7dee","repo":"hibernate/hibernate-orm","slug":"join-column-columnname-on-collection-property","errorCode":null,"errorMessage":"Join column '<columnName>' on collection property '<role>' must be defined with the same insertable and updatable attributes","messagePattern":"Join column '<columnName>' on collection property '<role>' must be defined with the same insertable and updatable attributes","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":2722,"sourceCode":"\t\t\t\t&& collection.getElement().getFetchStyle() != FetchStyle.JOIN ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\t\"@ManyToMany or @ElementCollection defining filter or where without join fetching \"\n\t\t\t\t\t\t\t+ \"not valid within collection using join fetching[\" + collection.getRole() + \"]\"\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate static void checkConsistentColumnMutability(Collection collection) {\n\t\tcheckConsistentColumnMutability( collection.getRole(), collection.getKey() );\n\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) {","sourceCodeStart":2704,"sourceCodeEnd":2740,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L2704-L2740","documentation":"Error \"Join column '<columnName>' on collection property '<role>' must be defined with the same insertable and updatable attributes\" 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":["Set the same insertable and updatable values on every @JoinColumn 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"}