Envers AuditEntity.revisionProperty("...").isNotNull() creates wrong sql

Description

Hello...

AuditEntity.revisionProperty("..").isNotNull() create sql in the form of

column_name <> null

instead of

column_name is not null

like the sql standard

says. E.g oracle handles "<>" different than "is not", so actual version is in this env usesless...

Environment

hibernate 3.6.1 , oracle 10g...
hibernate 3.6.3 , oracle 10g...

Activity

Show:
Uli Steinkopf
April 12, 2011, 8:02 PM

Seems that the Problem is not the creation of sql itself rather than the hql before.....

org.hibernate.envers.query.criteria.NotNullAuditExpression
...

public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuilder qb, Parameters parameters) {
String propertyName = propertyNameGetter.get(auditCfg);
RelationDescription relatedEntity = CriteriaTools.getRelatedEntity(auditCfg, entityName, propertyName);

if (relatedEntity == null) {
parameters.addWhereWithParam(propertyName, "<>", null); // !!!!!!this is the problem
} else {
relatedEntity.getIdMapper().addIdEqualsToQuery(parameters, null, propertyName, false);
}
}

So incorrect HQL is created.....

Uli Steinkopf
April 12, 2011, 8:46 PM

seems that change line 47 in org.hibernate.envers.query.criteria.NotNullAuditExpression to
parameters.addWhere(propertyName, true, "is not", "null",false);

fix the problem..May be there is a similiar prob in org.hibernate.envers.query.criteria.NullAuditExpression

Lukasz Antoniak
April 20, 2011, 11:36 PM
Edited

Very similar to HHH-4787.

Lukasz Antoniak
May 24, 2011, 11:10 PM

Fixed together with issue HHH-4787.

Brett Meyer
March 7, 2014, 10:09 PM

Bulk closing tickets resolved in released versions

Assignee

Lukasz Antoniak

Reporter

Uli Steinkopf

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure