Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. List<Movie> movies = movieRepository.getMoviesByGenres(Arrays.asList("Drama", "Comedy"))
  2.  
  3. @Entity
  4. public class Movie {
  5.  
  6. @Id
  7. @Column(name = "movie_id")
  8. private long id;
  9. private String title;
  10. @OneToMany(mappedBy = "movie")
  11. private Set<Genres> genres;
  12. ...
  13. }
  14.  
  15. @Entity
  16. public class Genres {
  17.  
  18. @Id
  19. private long id;
  20. @ManyToOne
  21. @JoinColumn(name = "movie_id", nullable = false)
  22. private Movie movie;
  23. private String name;
  24. ...
  25. }
  26.  
  27. public interface MovieRepository extends JpaRepository<Movie, Long>{
  28.  
  29. List<Movie> getMoviesByGenres(String name);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement