We are in process of upgrading Spring from 4.3.5 to 5.3.8. While doing so we are getting the following exception.

org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.gehcit.cp.chart.data.DocumentData.documentContributionDetail[com.gehcit.cp.chart.data.DocumentContributionData

The problem we are facing is the property "packageToScan" is not behaving expectedly. It does not pick up any entity files in the mentioned packages. However, if we add the same set of files in the property "annotatedClasses", it works fine.

I am attaching the server logs with TRACE and DEBUG enabled. the configuration file as well. context-infrastructure-persistence.zip server.txt server (2).txt

Comment From: Staticsubh

just verified, the same config is working fine with Spring 4.3.5 and it isn't for 5.3.8. Only the classes mentioned in annotatedClasses are being registered and sent to hibernate's addAnnotatedClass method. Please help me out on this.

Comment From: Staticsubh

@spring-projects-issues @nertzy @medwards Can you please look into this. I am stuck here for a long time. :(

Comment From: Staticsubh

Can someone please look into this

Comment From: Staticsubh

Hi all, PLease help me out here @spring-projects-issues @nertzy @medwards

Comment From: bclozel

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

Comment From: Staticsubh

This is surely a bug. Please tell me what info are you looking for ? I have already attached the required logs.