AuditQuery and @ElementCollection

#1

Given an entity model like

@Entity
@Audited
public class Location {
	@ElementCollection
	@Enumerated(STRING)
	private Set<LocationFunction> functions = new HashSet();
    ...
}

I see no way (with Hibernate Envers 5.x) to create an AuditQuery that filters Location revisions in such a way that I only get revisions for which the functions property contains a particular value like for example LocationFunction.AIRPORT.

@Naros: From the topic AuditQuery and relationships, I understand that Hibernate Envers 5.x supports only to-one mappings. To-many mappings are not yet supported with Hibernate Envers 5.x. I assume the same is true for @ElementCollection mappings. Is my assumption correct? Or am I missing something?

It is planned that traversal for to-many mappings will be supported with Hibernate Envers 6.0. Do you plan to also support @ElementCollection mappings with Hibernate Envers 6.0? Or will that come later?

Thanks a lot for your feedback

0 Likes

#2

You are correct that in Hibernate 5.x, the traversal API only supports the to-one type of mappings, so for your use case you would not be able to do that just yet. The hope with 6.0 is we finish the traversal API support and users will be able to do that across both to-many and element-collection mappings.

0 Likes