use of org.neo4j.ogm.domain.cineasts.annotated.Plays in project neo4j-ogm by neo4j.
the class CineastsIntegrationTest method loadFilmByRatingUserPlays.
@Test
public void loadFilmByRatingUserPlays() {
Filter filter = new Filter("level", ComparisonOperator.EQUALS, "ok");
filter.setOwnerEntityType(Movie.class);
filter.setNestedPath(new Filter.NestedPathSegment("ratings", Rating.class), new Filter.NestedPathSegment("user", User.class), new Filter.NestedPathSegment("plays", Plays.class));
Collection<Movie> films = session.loadAll(Movie.class, filter);
assertThat(films).hasSize(2);
}
use of org.neo4j.ogm.domain.cineasts.annotated.Plays in project neo4j-ogm by neo4j.
the class CineastsIntegrationTest method loadFilmByUserAndRatingUserPlays.
@Test
public void loadFilmByUserAndRatingUserPlays() {
Filter userFilter = new Filter("name", ComparisonOperator.EQUALS, "Michal");
userFilter.setNestedPath(new Filter.NestedPathSegment("ratings", Rating.class), new Filter.NestedPathSegment("user", User.class));
Filter playsFilter = new Filter("level", ComparisonOperator.EQUALS, "ok");
playsFilter.setOwnerEntityType(Movie.class);
playsFilter.setNestedPath(new Filter.NestedPathSegment("ratings", Rating.class), new Filter.NestedPathSegment("user", User.class), new Filter.NestedPathSegment("plays", Plays.class));
Filters filters = userFilter.and(playsFilter);
Collection<Movie> films = session.loadAll(Movie.class, filters);
assertThat(films).hasSize(2);
}
Aggregations