Envers looks at @MappedSuperclass ClassInfo to see if it has any attributes that are
audited. If it finds one, then Envers has to find the corresponding AttributeBinding in
the EntityBinding to get it's access type, column names, etc.
I don't think it really requires a MappedSuperclassBinding, but tweaking the domain
model would help.
I think adding a method like this will provide enough information:
javax.persistence.metamodel.Attribute.getDeclaringType() returning
ManagedType<X>
Currently domain model has:
org.hibernate.metamodel.spi.domain.Attribute.getAttributeContainer() returning
AttributeContainer
I think adding the following would work for Envers:
org.hibernate.metamodel.spi.domain.Attribute.getDeclaringAttributeContainer()
returning AttributeContainer
At least that's what I see so far...
----- Original Message -----
From: "Hardy Ferentschik" <hardy(a)hibernate.org>
To: "Steve Ebersole" <steve(a)hibernate.org>
Cc: "Hibernate" <hibernate-dev(a)lists.jboss.org>
Sent: Tuesday, February 18, 2014 3:34:31 AM
Subject: Re: [hibernate-dev] 5.0 metamodel binding
On 18 Jan 2014, at 04:28, Steve Ebersole <steve(a)hibernate.org> wrote:
> At the moment all of metamodel binding completely mis-handles
> MappedSuperclasses. The annotation source processor handles them somewhat,
> but in a very unusable way; it basically flattens all MappedSuperclass info
> into the nearest Entity. This is because the source package does not at
> all support the definition of MappedSuperclass. And then of course
> bindings do nothing with it, since it is not accounted for in source.
>
> To add this support I plan on the following changes:
>
> 1) Move lots of the information currently defined by RootEntitySource into
> EntityHierarchy. The identifier, version, etc is actually a function of
> the hierarchy as a whole, so conceptually it makes more sense there anyway.
> And that mirrors the way we modeled it in the binding spi.
> 2) Generalize the EntityHierarchy tree to allow mixing Entity and
> MappedSuperclass sources. A MappedSuperclass source actually needs to be
> defined.
> 3) Model MappedSuperclass in the binding spi as well.
+1 especially for #3. The reason the annotations side did this flattening was
as you say
the fact that there was no source equivalent. I think we might have discussed
this briefly
once, but affair back then we decided there was no special need to reflecting
mapped
super class in the source level.
—Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev