# AuditQuery and @ElementCollection

**URL:** <https://discourse.hibernate.org/t/auditquery-and-elementcollection/2526>\
**Category:** Hibernate ORM\
**Created:** [March 28, 2019, 9:32pm UTC](https://discourse.hibernate.org/t/auditquery-and-elementcollection/2526 "2019-03-28T21:32:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hawe](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/hawe/32/529_2.png) [@hawe](https://discourse.hibernate.org/u/hawe)\
**Post date:** [March 28, 2019, 9:32pm UTC](https://discourse.hibernate.org/t/auditquery-and-elementcollection/2526/1 "2019-03-28T21:32:36Z")

</div>

# 

Given an entity model like

```java
@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](https://discourse.hibernate.org/t/auditquery-and-relationships/2372), 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

---

<div class="post-metadata">

**Author:** ![Naros](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/naros/32/19_2.png) [@Naros](https://discourse.hibernate.org/u/Naros)\
**Post date:** [April 9, 2019, 2:43pm UTC](https://discourse.hibernate.org/t/auditquery-and-elementcollection/2526/2 "2019-04-09T14:43:17Z")

</div>

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.
