{"record":{"id":"4f83d57699e3b7f8","repo":"hibernate/hibernate-orm","slug":"association-role-has-a-jointable-with-inve","errorCode":null,"errorMessage":"Association '<role>' has a '@JoinTable' with 'inverseJoinColumns' and targets the type '<typeName>' which is not an '@Entity' type","messagePattern":"Association '<role>' has a '@JoinTable' with 'inverseJoinColumns' and targets the type '<typeName>' which is not an '@Entity' type","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java","lineNumber":2630,"sourceCode":"\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 ) {\n\t\t\t\t\tthrow new AnnotationException( \"Association '\" + safeCollectionRole()\n\t\t\t\t\t\t\t+ \"' is a '@ManyToAny' and must specify a '@JoinTable'\" );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfinal var joinTableAnn = propertyHolder.getJoinTable( property );\n\t\t\t\tif ( joinTableAnn != null && !ArrayHelper.isEmpty( joinTableAnn.inverseJoinColumns() ) ) {\n\t\t\t\t\tthrow new AnnotationException( \"Association '\" + safeCollectionRole()\n\t\t\t\t\t\t\t+ \" has a '@JoinTable' with 'inverseJoinColumns' and\"\n\t\t\t\t\t\t\t+ targetEntityMessage( elementType ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic String targetEntityMessage(TypeDetails elementType) {\n\t\tfinal String problem =\n\t\t\t\tisEntity( elementType.determineRawClass() )\n\t\t\t\t\t\t? \" which does not belong to the same persistence unit\"\n\t\t\t\t\t\t: \" which is not an '@Entity' type\";\n\t\treturn \" targets the type '\" + elementType.getName() + \"'\" + problem;\n\t}\n\n\tprivate static Class<? extends EmbeddableInstantiator> resolveCustomInstantiator(\n\t\t\tMemberDetails property,\n\t\t\tTypeDetails propertyClass,","sourceCodeStart":2612,"sourceCodeEnd":2648,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/CollectionBinder.java#L2612-L2648","documentation":"Error \"Association '<role>' has a '@JoinTable' with 'inverseJoinColumns' and targets the type '<typeName>' which is not an '@Entity' type\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An association or reference targets a type that Hibernate has not mapped as an entity.","commonSituations":"Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.","solutions":["Remove inverseJoinColumns from the @JoinTable, or make the target type an @Entity."],"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"}