Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. @Repository
  2. public interface BookRepository extends JpaRepository<Book,Long> {
  3.  
  4.     List<Book> findByAgeRestriction(AgeRestriction input);
  5. }
  6.  
  7.  
  8.  @Autowired
  9.     private BookService<Book, Long> bookService;
  10.  
  11.     @Autowired
  12.     private AuthorService<Author, Long> authorService;
  13.  
  14.     @Autowired
  15.     private CategoryService<Category, Long> categoryService;
  16.  
  17.  
  18.     private AuthorRepository authorRepository;
  19.     private BookRepository bookRepository;
  20.     private CategoryRepository categoryRepository;
  21.  
  22.     @Autowired
  23.     public ConsoleRunner(AuthorRepository authorRepository, BookRepository bookRepository, CategoryRepository categoryRepository) {
  24.         this.authorRepository = authorRepository;
  25.         this.bookRepository = bookRepository;
  26.         this.categoryRepository = categoryRepository;
  27.     }
  28.  
  29.     @Override
  30.     public void run(String... strings) throws Exception {
  31.         //seedDatabase();
  32.  
  33.         BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
  34.  
  35.         //PROBLEM 1: Books title by age restriction
  36.  
  37. //        String input=reader.readLine();
  38. //
  39. //        AgeRestriction age= AgeRestriction.valueOf(input.toUpperCase());
  40. //
  41. //        List<Book> byAgeRestriction = this.bookRepository.findByAgeRestriction(age);
  42. //
  43. //        for (Book book : byAgeRestriction) {
  44. //            System.out.println(book.getTitle());
  45. //        }
  46.         // END OF PROBLEM 1;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement