# "Not a managed type" error after spring/hibernate update

**URL:** <https://discourse.hibernate.org/t/not-a-managed-type-error-after-spring-hibernate-update/9120>\
**Category:** Hibernate ORM\
**Created:** [February 29, 2024, 7:34am UTC](https://discourse.hibernate.org/t/not-a-managed-type-error-after-spring-hibernate-update/9120 "2024-02-29T07:34:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KLangille](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@KLangille](https://discourse.hibernate.org/u/KLangille)\
**Post date:** [February 29, 2024, 7:34am UTC](https://discourse.hibernate.org/t/not-a-managed-type-error-after-spring-hibernate-update/9120/1 "2024-02-29T07:34:57Z")

</div>

After updating spring and hibernate we started getting the following error in some of our tests.

Spring: 6.1.3 Spring-boot: 3.2.2 Hibernate: 6.3.1.Final

```auto
Caused by: java.lang.IllegalArgumentException: Not a managed type: class a.b.c.MyClass
    at org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl.managedType(JpaMetamodelImpl.java:193)
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:463)
    at org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl.managedType(MappingMetamodelImpl.java:97)
    at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:82)
    at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:69)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:246)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:211)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:1)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279)
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:135)
    at org.springframework.data.util.Lazy.get(Lazy.java:113)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1820)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1769)

```

After stepping through the hibernate code I believe it is caused by this change [Re-add AvailableSettings.JPA\_METAMODEL\_GENERATION and re-enable metam… · hibernate/hibernate-orm@1184a59 · GitHub](https://github.com/hibernate/hibernate-orm/commit/1184a5963bfd2bbc4ef2db1fe60d3e6de15584c7) Our entity classes implement java.util.Map so they get excluded from entityTypes in the registerEntityType method.

Is this no longer allowed or is there some configuration we need to do?

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [March 4, 2024, 9:20am UTC](https://discourse.hibernate.org/t/not-a-managed-type-error-after-spring-hibernate-update/9120/2 "2024-03-04T09:20:02Z")

</div>

This could be a bug. Please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and if you are able to reproduce the issue, create a bug ticket in our [issue tracker](https://hibernate.atlassian.net) and attach that reproducer.

---

<div class="post-metadata">

**Author:** ![PK\_PK](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/pk_pk/32/3774_2.png) [@PK\_PK](https://discourse.hibernate.org/u/PK_PK)\
**Post date:** [January 17, 2025, 1:17pm UTC](https://discourse.hibernate.org/t/not-a-managed-type-error-after-spring-hibernate-update/9120/3 "2025-01-17T13:17:05Z")

</div>

Hi, how did you go about fixing this please? We are getting exactly this error after moving to spring boot 3.4.1 with hibernate core 6.6.4.Final.
