We have an application which uses the Hibernate AnnotationSessionFactoryBean, and which (for legacy reasons) specifies some mapped classes using an XML file, and some others using annotated classes. Some of the mappings in the XML file referred to classes mapped by annotations, and vice versa.
Under 2.5, this worked fine. The bean would read the XML mapping file, then the annotated mappings, and "blend" them.
However, due to the change in 2.5.1 to LocalSessionFactoryBean (see
SPR-2586), the XML mappings are eagerly compiled before the code in AnnotationSessionFactoryBean gets a look in, and because the XML mapping refers to annotation-mapped classes, this fails.
I was sure that this way of specifying mappings was valid and legal according to the documentation, but I can't seem to find the reference anywhere. It may have been wishful thinking on my part, and that this in fact a valid configuration.
I've fixed this for Spring 2.5.2, through introducing a "postProcessMappings" template method that AnnotationSessionFactoryBean implements now - invoked before "Configuration.buildMappings()".
This should be available in tonight's 2.5.2 snapshot (-368), available from http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SPR
Please give it a try and let me know whether it works for you!
Juergen