Make use of distinct predicate in envers

This commit is contained in:
Christian Beikov 2021-09-01 18:09:55 +02:00
parent 86000e9f22
commit 062c3cd724
1 changed files with 12 additions and 7 deletions

View File

@ -296,6 +296,10 @@ public class Parameters {
* @param addAliasRight Whether to add the alias to the right property.
*/
public void addWhereOrNullRestriction(String left, boolean addAliasLeft, String op, String right, boolean addAliasRight) {
if ( "=".equals( op ) ) {
addWhere( left, addAliasLeft, " is not distinct from ", right, addAliasRight );
}
else {
// apply the normal addWhere predicate
final Parameters sub1 = addSubParameters( "or" );
sub1.addWhere( left, addAliasLeft, op, right, addAliasRight );
@ -305,6 +309,7 @@ public class Parameters {
sub2.addNullRestriction( left, false );
sub2.addNullRestriction( right, false );
}
}
private void append(StringBuilder sb, String toAppend, MutableBoolean isFirst) {
if ( !isFirst.isSet() ) {