#379 Fix JPAQueryMixin.normalize

This commit is contained in:
Timo Westkämper 2013-03-29 16:52:20 +02:00
parent 34c3c29925
commit ea2f0ce833
3 changed files with 26 additions and 1 deletions

View File

@ -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);

View File

@ -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());

View File

@ -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);
}
}