Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<Movie> movies = movieRepository.getMoviesByGenres(Arrays.asList("Drama", "Comedy"))
- @Entity
- public class Movie {
- @Id
- @Column(name = "movie_id")
- private long id;
- private String title;
- @OneToMany(mappedBy = "movie")
- private Set<Genres> genres;
- ...
- }
- @Entity
- public class Genres {
- @Id
- private long id;
- @ManyToOne
- @JoinColumn(name = "movie_id", nullable = false)
- private Movie movie;
- private String name;
- ...
- }
- public interface MovieRepository extends JpaRepository<Movie, Long>{
- List<Movie> getMoviesByGenres(String name);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement