RevisionsOfEntityQuery associationQueries

Description

In RevisionsOfEntityQuery associationQueries are not added when list() method is called. TraverseRelation then doesnť work. Will it be ever added, please? Thank you.

Environment

None

Activity

Show:
Chris Cranford
May 12, 2017, 12:37 PM

Are you discussing relations of many-to-many and one-to-many? We have one-to-one and many-to-one support already and have the remaining planned as part of HHH-11735. If that isn't what you're referring to, please provide a test case or example of what it is you're asking.

anet
May 16, 2017, 7:02 AM
Edited

I have three entities with OneToMany relation. Author -> Book -> BookEdition.

There is no problem to do this:

AuditQuery auditQuery = AuditReaderFactory.get(getCurrentSession()).createQuery().forEntitiesAtRevision(BookEdition.class, 1);
auditQuery
.traverseRelation("book", JoinType.INNER, "book")
.traverseRelation("author", JoinType.INNER, "author").up().up()
.add(AuditEntity.property("author","lastname").like("******"));

List<BookEdition> bookEditions = auditQuery.getResultList();

But when I want to do the same with forRevisionsOfEntity, it is not working, because alias for author doesn't exist.
AuditQuery auditQuery = AuditReaderFactory.get(getCurrentSession()).createQuery().forRevisionsOfEntity(BookEdition.class, false, false);

Chris Cranford
May 16, 2017, 3:24 PM

Thanks , that was intentional when we first implemented association queries. For this particular type of query, we have to address the obscure differences in the query result-set because the internal queries vary depending whether you specify to selectOnlyEntities=true vs selectOnlyEntities=false and how that impacts the association queries.

I'll tentatively place this in the 6.0 category and we'll try to include this in that major release.

anet
May 17, 2017, 5:46 AM

Ok, thanks.

Assignee

Unassigned

Reporter

anet

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical
Configure