Hibernate spring.jpa.mapping-resources=hibernate.cfg.xml not read after Spring-Boot 2.1.0


I logged the following issue on Spring Boot issue tracker and have now been directed here.

Spring-Boot 2.0.8 adds the mappings by creating entities from the *hbm.xml files listed in spring.jpa.mapping-resources=hibernate.cfg.xml, Any release after that ignores the mapping file.

javax.persistence.metamodel.Metamodel metaModel = emf.getMetamodel();
Set<EntityType<?>> entityTypeSet = metaModel.getEntities();



HH12871 has been implicated as reason why our mapped classes are no longer ending up as EntityType.

We have mappings and use the EntityType created by Hibernate to get hold of its Attributes and their JavaType.

EntityType persistEntityType = iceEntityManager.get(persistEntityName);
        Attribute persistAttribute = persistEntityType.getAttribute(attributeName);
        Class persistAttributeJavaTypeClass = persistAttribute.getJavaType();

Previously this was no problem at all.
In our project there just is no difference between the mapped classes and the annotated
@Entity classes. Why should there be a difference?


If you can replicate it using this test case, you should open a Jira issue.


Thanks. Created jira issue. https://hibernate.atlassian.net/browse/HHH-13250


Thanks. Now, since you investigated the issue, you should try to provide a fix. Send us a Pull Request and we will investigate it afterward.


Sure… in a perfect world where i have time to figure out all the Hibernate internals. In the meantime i’ll stick to that release until i can squeeze it no further.


I surely understand what you mean since we also don’t have the resources to fix all the issues and since HBM mappings are considered deprecated, this issue does not have a high priority.