Hello,
I was just about to ask if the test breaking is an intermediate thing or should I look at
it :).
Adam, I think I found a little more. So in
CollectionMetadataGenerator
these enum sets are being routed through #addWithMiddleTable where we
seem to be creating audit entities for these collection-of-enums.
Is that what you expect? Being largely naive in this code I was
surprised by that.
Yes, that's right. The entity defines two
collection-of-elements relations:
@Audited
@CollectionOfElements
@Enumerated(EnumType.STRING)
private Set<E1> enums1;
@Audited
@CollectionOfElements
@Enumerated(EnumType.ORDINAL)
private Set<E2> enums2;
so it's a total of three audit tables.
Anyway, the break down seems to happen in #addValueToMiddleTable when
it
tries to call value.getType(). "value" is the
propertyValue.getElement() from #addWithMiddleTable, where
"propertyValue" is the set-of-enum property definition. The problem is
that here the type parameters are null where as in earlier calls they
were not. "propertyValue" seems to refer to the original mapping
instances here, not the audit maping instance, which I again found
surprising.
The problem was that the Type class/interface hierarchy changed, and I think EnumType
stopped being a CustomType, and the type properties weren't added to the mapping.
I've now fixed and simplified this, so that the type properties are always added if
they are present. The fix is committed and all (Envers) tests pass.
--
Adam Warski
http://www.warski.org
http://www.softwaremill.eu