using hibernate-jpamodelgen-4.3.6.Final, if you go inside org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor#process method you'll see the following code:
Set<? extends Element> elements = roundEnvironment.getRootElements();
for ( Element element : elements ) {
if ( isJPAEntity( element ) ) {
context.logMessage( Diagnostic.Kind.OTHER, "Processing annotated class " + element.toString() );
handleRootElementAnnotationMirrors( element );
}
}
if you want inner class to be processed, we simply need to add the following:
Set<? extends Element> elements = roundEnvironment.getRootElements();
for ( Element element : elements ) {
if ( isJPAEntity( element ) ) {
for (Element enclosedElement : element.getEnclosedElements()) {
if ( isJPAEntity(enclosedElement)) {
context.logMessage( Diagnostic.Kind.OTHER, "Processing inner annotated class " + element.toString() );
handleRootElementAnnotationMirrors( enclosedElement );
}
}
context.logMessage( Diagnostic.Kind.OTHER, "Processing annotated class " + element.toString() );
handleRootElementAnnotationMirrors( element );
}
}
I've just ran the patched code and it appears that the composite id class is getting generated in it's proper (non-inner) class. Note: I do not think we need to recurse within all the enclosed element ; to me, it would appear a bit weird to stack multiple inner class.
Is there anything I've missed ?
Thanks,
|