Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Repository
- public interface BookRepository extends JpaRepository<Book,Long> {
- List<Book> findByAgeRestriction(AgeRestriction input);
- }
- @Autowired
- private BookService<Book, Long> bookService;
- @Autowired
- private AuthorService<Author, Long> authorService;
- @Autowired
- private CategoryService<Category, Long> categoryService;
- private AuthorRepository authorRepository;
- private BookRepository bookRepository;
- private CategoryRepository categoryRepository;
- @Autowired
- public ConsoleRunner(AuthorRepository authorRepository, BookRepository bookRepository, CategoryRepository categoryRepository) {
- this.authorRepository = authorRepository;
- this.bookRepository = bookRepository;
- this.categoryRepository = categoryRepository;
- }
- @Override
- public void run(String... strings) throws Exception {
- //seedDatabase();
- BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
- //PROBLEM 1: Books title by age restriction
- // String input=reader.readLine();
- //
- // AgeRestriction age= AgeRestriction.valueOf(input.toUpperCase());
- //
- // List<Book> byAgeRestriction = this.bookRepository.findByAgeRestriction(age);
- //
- // for (Book book : byAgeRestriction) {
- // System.out.println(book.getTitle());
- // }
- // END OF PROBLEM 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement