| I have a entity-mappings xml file containing entities. These get enhanced in the 4.x series but in 5.2.x series they are neglected and I feel like
HHH-10245 Closed all over again. I didn't go through the xml files back then but this involves OSGi class weaving. I see that pretty much everything has changed around the metamodel so I can't pinpoint the exact time when this has happened, but it seems to me that this has been there hiding all along. The weaving kicks in while AnnotationMetadataSourceProcessorImpl handling the MetadataBuildingContext. There the mappings are turned into class files via xClasses causing the class weaving, but for some reason the EnhancementContext that has been pushed to the class transformer doesn't look into xml mapping bindings but only checks annotated classes. This all happens in the constructor where toXClass is made.
final JPAMetadataProvider jpaMetadataProvider = (JPAMetadataProvider) ( (MetadataProviderInjector) reflectionManager ).getMetadataProvider();
for ( Binding xmlBinding : managedResources.getXmlMappingBindings() ) {
if ( !org.dom4j.Document.class.isInstance( xmlBinding.getRoot() ) ) {
continue;
}
org.dom4j.Document dom4jDocument = (Document) xmlBinding.getRoot();
final List<String> classNames = jpaMetadataProvider.getXMLContext().addDocument( dom4jDocument );
for ( String className : classNames ) {
xClasses.add( toXClass( className, reflectionManager ) );
}
}
My proposal is that before this either xml mapping bindings are to be converted to annotated classes or enhancement context is extended to understand xml bindings. The latter seems to me the better solution although it involves currently dom4j. |