Skip to content

Commit

Permalink
Add test #482
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Aug 23, 2013
1 parent 83de29f commit 25845de
Showing 1 changed file with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.mysema.query.domain;

import static org.junit.Assert.assertNotNull;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.junit.Test;

import com.mysema.query.annotations.QueryInit;
import com.mysema.query.types.expr.BooleanExpression;

public class AnyPathTest {
@Entity
public static class Foo {

@OneToMany(mappedBy = "key.foo")
@QueryInit("key.student")
private Set<Bar> bars = new HashSet<Bar>();

}

@Entity
public static class Bar {

@EmbeddedId
@QueryInit("student")
private BarId key = new BarId();

}

@Embeddable
public static class BarId {

@ManyToOne
private Student student;

@ManyToOne
private Foo foo;

}

@Entity
public static class Student {

}

private BooleanExpression authorFilter(Student student){
//return QFoo.foo.bars.any().key.student.eq(Student student);
return QAnyPathTest_Foo.foo.bars.any().key.student.eq(student);
}

@Test
public void AnyPath() {
assertNotNull(authorFilter(new Student()));
}

}

0 comments on commit 25845de

Please sign in to comment.