content: package com.bookstore.service;
  
  import com.bookstore.entity.Author;
  import com.bookstore.entity.Book;
  import com.bookstore.repository.AuthorRepository;
  import com.bookstore.repository.BookRepository;
  import org.springframework.stereotype.Service;
  
  @Service
  public class BookstoreService {
  
      private final AuthorRepository authorRepository;
      private final BookRepository bookRepository;
  
      public BookstoreService(AuthorRepository authorRepository, BookRepository bookRepository) {
          this.authorRepository = authorRepository;
          this.bookRepository = bookRepository;
      }
  
      public Author persistAuthor() {
          Author author = new Author();
          author.setName("Joana Nimar");
          author.setGenre("History");
          author.setAge(34);
  
          return authorRepository.save(author);
      }
  
      public Book persistBook() {
          Book book = new Book();
          book.setIsbn("001-JN");
          book.setTitle("A History of Ancient Prague");
  
          return bookRepository.save(book);
      }
  
  }
  