mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-13 06:34:50 +00:00
Make use of distinct predicate in envers
This commit is contained in:
parent
86000e9f22
commit
062c3cd724
@ -296,14 +296,19 @@ public void addWhere( String leftAlias, String left, String op, QueryBuilder rig
|
||||
* @param addAliasRight Whether to add the alias to the right property.
|
||||
*/
|
||||
public void addWhereOrNullRestriction(String left, boolean addAliasLeft, String op, String right, boolean addAliasRight) {
|
||||
// apply the normal addWhere predicate
|
||||
final Parameters sub1 = addSubParameters( "or" );
|
||||
sub1.addWhere( left, addAliasLeft, op, right, 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 );
|
||||
|
||||
// apply the is null predicate for both join properties
|
||||
final Parameters sub2 = sub1.addSubParameters( "and" );
|
||||
sub2.addNullRestriction( left, false );
|
||||
sub2.addNullRestriction( right, false );
|
||||
// apply the is null predicate for both join properties
|
||||
final Parameters sub2 = sub1.addSubParameters( "and" );
|
||||
sub2.addNullRestriction( left, false );
|
||||
sub2.addNullRestriction( right, false );
|
||||
}
|
||||
}
|
||||
|
||||
private void append(StringBuilder sb, String toAppend, MutableBoolean isFirst) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user