mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
#379 Fix JPAQueryMixin.normalize
This commit is contained in:
parent
34c3c29925
commit
ea2f0ce833
@ -23,6 +23,7 @@ import com.mysema.query.JoinExpression;
|
||||
import com.mysema.query.alias.Alias;
|
||||
import com.mysema.query.domain.QCommonPersistence;
|
||||
import com.mysema.query.types.PathMetadataFactory;
|
||||
import com.mysema.query.types.Predicate;
|
||||
import com.mysema.query.types.expr.BooleanExpression;
|
||||
|
||||
public class QueryMixinTest {
|
||||
@ -32,6 +33,11 @@ public class QueryMixinTest {
|
||||
|
||||
private QCommonPersistence entity = new QCommonPersistence(PathMetadataFactory.forVariable("entity"));
|
||||
|
||||
@Test
|
||||
public void Where_Null() {
|
||||
mixin.where((Predicate)null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GetJoins_with_condition() {
|
||||
mixin.innerJoin(entity);
|
||||
|
||||
@ -71,7 +71,9 @@ public class JPAQueryMixin<T> extends QueryMixin<T> {
|
||||
|
||||
@Override
|
||||
protected Predicate normalize(Predicate predicate, boolean where) {
|
||||
predicate = (Predicate) ExpressionUtils.extract(predicate);
|
||||
if (predicate != null) {
|
||||
predicate = (Predicate) ExpressionUtils.extract(predicate);
|
||||
}
|
||||
if (predicate != null) {
|
||||
// transform any usage
|
||||
predicate = (Predicate) predicate.accept(JPACollectionAnyVisitor.DEFAULT, new Context());
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package com.mysema.query.jpa;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.query.types.Predicate;
|
||||
|
||||
public class JPAQueryMixinTest {
|
||||
|
||||
private JPAQueryMixin mixin = new JPAQueryMixin();
|
||||
|
||||
@Test
|
||||
public void Where_Null() {
|
||||
mixin.where((Predicate)null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user