Felix Feisst, my test case is using the following entity configurations:
@Entity(name = "EntityA")
@Audited
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class EntityA {
@Id
private Integer id;
@OneToOne
private EntityC relationToC;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public EntityC getRelationToC() {
return relationToC;
}
public void setRelationToC(EntityC relationToC) {
this.relationToC = relationToC;
}
}
@Entity(name = "EntityB")
@Audited
public class EntityB extends EntityA {
}
@Entity(name = "EntityC")
@Audited
public class EntityC {
@Id
private Integer id;
private String foo;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
}
I then create the test record as follows:
@Test
@Priority(10)
public void initData() {
TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
final EntityC c = new EntityC();
c.setId( 1 );
c.setFoo( "bar" );
entityManager.persist( c );
final EntityB b = new EntityB();
b.setId( 1 );
b.setRelationToC( c );
entityManager.persist( b );
} );
}
followed by
@Test(expected = InvalidWithClauseException.class)
public void testAuditQuery() {
List results = getAuditReader().createQuery().forEntitiesAtRevision( EntityB.class, 1 )
.traverseRelation( "relationToC", JoinType.INNER )
.add( AuditEntity.property( "foo" ).eq( "bar" ) )
.getResultList();
}
This does not fail, is this specific to a certain dialect or environment configuration? |