hibernate/hibernate-orm · error · AnnotationException
All join columns on collection '<role>' should have the same
Error message
All join columns on collection '<role>' should have the same insertable and updatable setting
What it means
Error "All join columns on collection '<role>' should have the same insertable and updatable setting" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java:2732
checkConsistentColumnMutability( collection.getRole(), collection.getElement() );
}
private static void checkConsistentColumnMutability(String collectionRole, Value value) {
Boolean readOnly = null;
for ( int i = 0; i < value.getColumnSpan(); i++ ) {
final boolean insertable = value.isColumnInsertable( i );
if ( insertable != value.isColumnUpdateable( i ) ) {
throw new AnnotationException(
"Join column '" + value.getColumns().get( i ).getName() + "' on collection property '"
+ collectionRole + "' must be defined with the same insertable and updatable attributes"
);
}
if ( readOnly == null ) {
readOnly = insertable;
}
else if ( readOnly != insertable && !value.getColumns().get( i ).isFormula() ) {
// We also assert that all join columns have the same mutability (except formulas)
throw new AnnotationException(
"All join columns on collection '" + collectionRole + "' should have" +
" the same insertable and updatable setting"
);
}
}
}
private void bindCollectionSecondPass(PersistentClass targetEntity, AnnotatedJoinColumns joinColumns) {
if ( !isUnownedCollection() ) {
createSyntheticPropertyReference(
joinColumns,
collection.getOwner(),
collection.getOwner(),
collection,
propertyName,
false,
buildingContextView on GitHub (pinned to fad1729dce)
Solutions
- Align insertable and updatable settings across all join columns of the collection.
When it happens
Trigger: A '@JoinColumn' / 'referencedColumnName' does not line up with the columns mapped by the target entity.
Common situations: Composite foreign keys, associations to entities with secondary tables, or reordered/duplicated referencedColumnName values across multiple @JoinColumn declarations.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/82ec0bc539728e4a.
Report an issue: GitHub.