Search in sources :

Example 1 with Plays

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);
}
Also used : Movie(org.neo4j.ogm.domain.cineasts.annotated.Movie) User(org.neo4j.ogm.domain.cineasts.annotated.User) Filter(org.neo4j.ogm.cypher.Filter) Plays(org.neo4j.ogm.domain.cineasts.annotated.Plays) Rating(org.neo4j.ogm.domain.cineasts.annotated.Rating) Test(org.junit.Test)

Example 2 with Plays

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);
}
Also used : Movie(org.neo4j.ogm.domain.cineasts.annotated.Movie) Filters(org.neo4j.ogm.cypher.Filters) User(org.neo4j.ogm.domain.cineasts.annotated.User) Filter(org.neo4j.ogm.cypher.Filter) Plays(org.neo4j.ogm.domain.cineasts.annotated.Plays) Rating(org.neo4j.ogm.domain.cineasts.annotated.Rating) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Filter (org.neo4j.ogm.cypher.Filter)2 Movie (org.neo4j.ogm.domain.cineasts.annotated.Movie)2 Plays (org.neo4j.ogm.domain.cineasts.annotated.Plays)2 Rating (org.neo4j.ogm.domain.cineasts.annotated.Rating)2 User (org.neo4j.ogm.domain.cineasts.annotated.User)2 Filters (org.neo4j.ogm.cypher.Filters)1