Skip to content

Commit

Permalink
#379 Fix JPAQueryMixin.normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Mar 29, 2013
1 parent 34c3c29 commit ea2f0ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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 {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public <RT> Expression<RT> convert(Expression<RT> expr) {

@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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}


}

0 comments on commit ea2f0ce

Please sign in to comment.