public void addToQuery(AuditConfiguration auditCfg, AuditReaderImplementor versionsReader, String entityName,
QueryBuilder qb, Parameters parameters) {
String propertyName = CriteriaTools.determinePropertyName( auditCfg, versionsReader, entityName, propertyNameGetter );
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);
if (relatedEntity == null) {
parameters.addWhereWithParam(propertyName, op, value);
} else {
if (!"=".equals(op) && !"<>".equals(op)) {
throw new AuditException("This type of operation: " + op + " (" + entityName + "." + propertyName +
") isn't supported and can't be used in queries.");
}
Object id = relatedEntity.getIdMapper().mapToIdFromEntity(value);
relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, id, null, "=".equals(op));
}
}