{"record":{"id":"bbddb0790228e69e","repo":"hibernate/hibernate-orm","slug":"collection-s-is-both-sorted-and-ordered-only-o","errorCode":null,"errorMessage":"Collection '%s' is both sorted and ordered (only one of '@%s', '@%s', '@%s', and '@%s' may be used)","messagePattern":"Collection '(.+?)' is both sorted and ordered \\(only one of '@(.+?)', '@(.+?)', '@(.+?)', and '@(.+?)' may be used\\)","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":1396,"sourceCode":"\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate AnnotationException buildIllegalOrderCombination() {\n\t\treturn new AnnotationException(\n\t\t\t\tString.format(\n\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\"Collection '%s' is annotated both '@%s' and '@%s'\",\n\t\t\t\t\t\tsafeCollectionRole(),\n\t\t\t\t\t\tjakarta.persistence.OrderBy.class.getName(),\n\t\t\t\t\t\torg.hibernate.annotations.SQLOrder.class.getName()\n\t\t\t\t)\n\t\t);\n\t}\n\n\tprivate AnnotationException buildIllegalOrderAndSortCombination() {\n\t\tthrow new AnnotationException(\n\t\t\t\tString.format(\n\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\"Collection '%s' is both sorted and ordered (only one of '@%s', '@%s', '@%s', and '@%s' may be used)\",\n\t\t\t\t\t\tsafeCollectionRole(),\n\t\t\t\t\t\tjakarta.persistence.OrderBy.class.getName(),\n\t\t\t\t\t\torg.hibernate.annotations.SQLOrder.class.getName(),\n\t\t\t\t\t\tSortComparator.class.getName(),\n\t\t\t\t\t\tSortNatural.class.getName()\n\t\t\t\t)\n\t\t);\n\t}\n\n\tprivate AnnotationException buildIllegalSortCombination() {\n\t\treturn new AnnotationException(\n\t\t\t\tString.format(\n\t\t\t\t\t\t\"Collection '%s' is annotated both '@%s' and '@%s'\",\n\t\t\t\t\t\tsafeCollectionRole(),\n\t\t\t\t\t\tSortNatural.class.getName(),","sourceCodeStart":1378,"sourceCodeEnd":1414,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L1378-L1414","documentation":"Error \"Collection '%s' is both sorted and ordered (only one of '@%s', '@%s', '@%s', and '@%s' may be used)\" 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":["Keep only one of the sorting/ordering annotations on the collection and remove the others."],"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"}