{"record":{"id":"5696ca66151d9831","repo":"quarkusio/quarkus","slug":"repository-repository-specifies-multiple-id-typ","errorCode":null,"errorMessage":"Repository ${repository} specifies multiple ID types","messagePattern":"Repository (.+?) specifies multiple ID types","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java","lineNumber":165,"sourceCode":"\n        // we need to pull the entity and ID types for the Spring Data generic types\n        // we also need to make sure that the user didn't try to specify multiple different types\n        // in the same interface (which is possible if only Repository is used)\n        for (DotName extendedSpringDataRepo : GenerationUtil.extendedSpringDataRepos(repositoryToImplement, indexView)) {\n            List<Type> types = JandexUtil.resolveTypeParameters(repositoryToImplement.name(), extendedSpringDataRepo, index);\n            if (!(types.get(0) instanceof ClassType)) {\n                throw new IllegalArgumentException(\n                        \"Entity generic argument of \" + repositoryToImplement + \" is not a regular class type\");\n            }\n            DotName newEntityDotName = types.get(0).name();\n            if ((entityDotName != null) && !newEntityDotName.equals(entityDotName)) {\n                throw new IllegalArgumentException(\"Repository \" + repositoryToImplement + \" specifies multiple Entity types\");\n            }\n            entityDotName = newEntityDotName;\n\n            DotName newIdDotName = types.get(1).name();\n            if ((idDotName != null) && !newIdDotName.equals(idDotName)) {\n                throw new IllegalArgumentException(\"Repository \" + repositoryToImplement + \" specifies multiple ID types\");\n            }\n            idDotName = newIdDotName;\n        }\n\n        if (idDotName == null || entityDotName == null) {\n            throw new IllegalArgumentException(\n                    \"Repository \" + repositoryToImplement + \" does not specify ID and/or Entity type\");\n        }\n\n        return new AbstractMap.SimpleEntry<>(idDotName, entityDotName);\n    }\n\n    private void createCustomImplFields(io.quarkus.gizmo2.creator.ClassCreator repositoryImpl,\n            List<DotName> customInterfaceNamesToImplement,\n            IndexView index, Map<String, FieldDesc> customImplNameToFieldDescriptor) {\n        Set<String> customImplClassNames = new HashSet<>(customInterfaceNamesToImplement.size());\n\n        // go through the interfaces and collect the implementing classes in a Set","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java#L147-L183","documentation":"Analogous to the entity mismatch check, Quarkus requires all Spring Data interfaces extended by a repository to resolve to the same ID type. If the ID generic argument differs across the hierarchy (e.g. Long in one parent, UUID in another), the generated implementation cannot be typed consistently and augmentation fails.","triggerScenarios":"A repository extends interfaces parameterized with different ID types, e.g. CrudRepository<User, Long> plus a custom base extending Repository<User, UUID>.","commonSituations":"Changing an entity's @Id type and forgetting one parent interface; mixing repository fragments with different ID generics; copy-pasted base interfaces.","solutions":["Make all parent Spring Data interfaces use the same ID type parameter","Update any stale parent interface to the entity's actual @Id field type","Keep one repository interface per entity/ID combination"],"exampleFix":"// before\ninterface UserRepo extends CrudRepository<User, Long>, Repository<User, UUID> { }\n// after\ninterface UserRepo extends CrudRepository<User, Long> { }","handlingStrategy":"validation","validationCode":"// ID type must match the entity's @Id field across all parents\n// e.g. @Id private Long id; => CrudRepository<User, Long> everywhere","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When changing an entity's @Id type, update every repository referencing it","Keep ID generic consistent across CrudRepository/Repository/JpaRepository parents","Use wrapper types (Long/Integer) for IDs to avoid primitive edge cases"],"tags":["quarkus","spring-data-jpa","generics","build-time"],"backgroundTag":"invalid-generic-type-parameter","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}