{"record":{"id":"b33e8f82648df53a","repo":"hibernate/hibernate-orm","slug":"collectiontype-role-specified-paramet","errorCode":null,"errorMessage":"'@CollectionType' [\" + role + \"] specified parameters, but the implementation '\" + implementation.getName() + \"' does not implement 'ParameterizedType' which is used to inject them","messagePattern":"'@CollectionType' \\[\" \\+ role \\+ \"\\] specified parameters, but the implementation '\" \\+ implementation\\.getName\\(\\) \\+ \"' does not implement 'ParameterizedType' which is used to inject them","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/mapping/MappingHelper.java","lineNumber":71,"sourceCode":"\t\t\t\t\t\t.getBean( userCollectionTypeClass );\n\t\tif ( isNotEmpty( parameters ) ) {\n\t\t\tif ( ParameterizedType.class.isAssignableFrom( managedBean.getBeanClass() ) ) {\n\t\t\t\t// create a copy of the parameters and create a bean wrapper to delay injecting\n\t\t\t\t// the parameters, thereby delaying the need to resolve the instance from the\n\t\t\t\t// wrapped bean\n\t\t\t\tfinal var copy = new Properties();\n\t\t\t\tcopy.putAll( parameters );\n\t\t\t\treturn new DelayedParameterizedTypeBean<>( managedBean, copy );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrowIgnoredCollectionTypeParameters( role, userCollectionTypeClass );\n\t\t\t}\n\t\t}\n\t\treturn managedBean;\n\t}\n\n\tprivate static void throwIgnoredCollectionTypeParameters(String role, Class<?> implementation) {\n\t\tthrow new MappingException( \"'@CollectionType' [\" + role + \"] specified parameters, but the implementation '\"\n\t\t\t\t+ implementation.getName() + \"' does not implement 'ParameterizedType' which is used to inject them\" );\n\t}\n\n\tpublic static void injectParameters(Object type, Properties parameters) {\n\t\tif ( type instanceof ParameterizedType parameterizedType ) {\n\t\t\tparameterizedType.setParameterValues( parameters == null ? EMPTY_PROPERTIES : parameters );\n\t\t}\n\t\telse if ( parameters != null && !parameters.isEmpty()\n\t\t\t\t&& !( type instanceof AnnotationBasedUserType<?,?> ) ) {\n\t\t\tthrow new MappingException( \"'UserType' implementation '\" + type.getClass().getName()\n\t\t\t\t\t+ \"' does not implement 'ParameterizedType' or 'AnnotationBasedUserType' but parameters were provided\" );\n\t\t}\n\t}\n\n\tprivate static ManagedBean<UserCollectionType> createLocalUserTypeBean(\n\t\t\tString role,\n\t\t\tClass<? extends UserCollectionType> implementation,\n\t\t\tMap<String, ?> parameters) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/mapping/MappingHelper.java#L53-L89","documentation":"MappingHelper throws when a @CollectionType custom collection implementation was given parameters, but the implementation class does not implement org.hibernate.usertype.ParameterizedType - the interface Hibernate uses to inject those parameter values.","triggerScenarios":"@CollectionType(implementation = X.class, parameters = @Param(...)) where X does not implement ParameterizedType; hbm <collection-type ...><param>...</param></collection-type> with the same problem; porting a UserCollectionType that never needed parameters into a mapping that now supplies them.","commonSituations":"Adding parameters to an existing custom collection type; copy-pasting @CollectionType declarations between collections; upgrading mappings to push configuration into collection types.","solutions":["Implement org.hibernate.usertype.ParameterizedType on the collection type class (override setParameterValues(Properties)) and consume the parameters.","Or remove the parameters from the @CollectionType declaration if they are unused.","If per-collection configuration is required without ParameterizedType, use a distinct implementation class per configuration."],"exampleFix":"// before\npublic class MyCollectionType implements UserCollectionType { ... }\n\n@CollectionType(implementation = MyCollectionType.class,\n                parameters = @Param(name = \"k\", value = \"v\"))\nList<Item> items;\n\n// after\npublic class MyCollectionType implements UserCollectionType, ParameterizedType {\n    @Override\n    public void setParameterValues(Properties parameters) { ... }\n}","handlingStrategy":"validation","validationCode":"static boolean acceptsParameters(Class<? extends UserCollectionType> impl) {\n    return org.hibernate.usertype.ParameterizedType.class.isAssignableFrom(impl);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make ParameterizedType part of the base class for all custom collection types.","Only pass @Param values to implementations designed to read them.","Cover custom collection types with mapping tests that build Metadata."],"tags":["hibernate","orm","mapping","collection-type","parameters","user-collection-type"],"backgroundTag":"type-parameters-not-supported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}