[hibernate-dev] Metamodel, Jandex and "XML mixins"

Hardy Ferentschik hardy at hibernate.org
Thu Mar 27 06:57:53 EDT 2014


On 27 Jan 2014, at 04:29, Steve Ebersole <steve at hibernate.org> wrote:

> I was looking into some failures on master in regards to XML overrides for
> JPA annotations in relation to our friend Access/AccessType.  Which got me
> to thinking...
> 
> How does the "mixin" code handle defining the target for the
> AnnotationInstances it creates?

AFAIK it needs to look at two things, the ‘access’ attribute of the persistence unit and the ‘access' attribute 
of the entity node. Based on that it should create an AnnotationInstance with the appropriate AnnotationTarget.
Once these pseudo annotation are created the processing of the mapping information is the same as with actual
annotation defined on the entities (metadata-complete needs to be handled here as well in a sense that if
a xml mapped entity is metadata-complete, existing AnnotationInstances based on actual annotations must be removed).

That’s how it should work. However, this was Strong’s baby. Maybe he could shed some more light on this.

> Seems to me this code would have really no idea whether to choose the field
> or the getter as the target.  Which is potentially problematic as we are
> validating the "placement" of these annotations.

It does, based on the ‘access’ attribute (see above)

—Hardy


More information about the hibernate-dev mailing list