{"record":{"id":"99c15416f3da59e6","repo":"hibernate/hibernate-orm","slug":"association-role-is-an-unowned-collection-and","errorCode":null,"errorMessage":"Association '<role>' is an unowned collection and may not be annotated '@Check'","messagePattern":"Association '<role>' is an unowned collection and may not be annotated '@Check'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":2604,"sourceCode":"\t\t\t\t\t\t.getValue();\n\t\tfinal var table =\n\t\t\t\tmappedByPropertyValue instanceof Collection collectionProperty\n\t\t\t\t\t\t// this is a collection on the other side\n\t\t\t\t\t\t? collectionProperty.getCollectionTable()\n\t\t\t\t\t\t// this is a ToOne with a @JoinTable or a regular property\n\t\t\t\t\t\t: mappedByPropertyValue.getTable();\n\t\tcollection.setCollectionTable( table );\n\n\t\tprocessSoftDeletes();\n\t\tprocessTemporal();\n\t\tprocessAudited();\n\t\tcheckCheckAnnotation();\n\t}\n\n\tprivate void checkCheckAnnotation() {\n\t\tif ( property.hasDirectAnnotationUsage( Checks.class )\n\t\t\t|| property.hasDirectAnnotationUsage( Check.class ) ) {\n\t\t\tthrow new AnnotationException( \"Association '\" + safeCollectionRole()\n\t\t\t\t\t+ \" is an unowned collection and may not be annotated '@Check'\" );\n\t\t}\n\t}\n\n\tprivate void detectManyToManyProblems(\n\t\t\tTypeDetails elementType,\n\t\t\tboolean isCollectionOfEntities,\n\t\t\tboolean isManyToAny) {\n\n\t\tif ( !isCollectionOfEntities) {\n\t\t\tif ( property.hasDirectAnnotationUsage( ManyToMany.class )\n\t\t\t\t\t|| property.hasDirectAnnotationUsage( OneToMany.class ) ) {\n\t\t\t\tthrow new AnnotationException( \"Association '\" + safeCollectionRole() + \"'\"\n\t\t\t\t\t\t+ targetEntityMessage( elementType ) );\n\t\t\t}\n\t\t\telse if (isManyToAny) {\n\t\t\t\tfinal var joinTable = propertyHolder.getJoinTable( property );\n\t\t\t\tif ( joinTable == null ) {","sourceCodeStart":2586,"sourceCodeEnd":2622,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L2586-L2622","documentation":"Error \"Association '<role>' is an unowned collection and may not be annotated '@Check'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A collection mapping uses an annotation or annotation combination that Hibernate forbids for collections.","commonSituations":"Collections carrying conflicting ordering/sorting (@Sort* vs @OrderBy/@OrderColumn), misplaced @JoinColumn, or annotations only valid for single-valued associations.","solutions":["Remove @Check from the unowned (mappedBy) collection side; place it on the owning side instead."],"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"}