// TODO test @Override @Transactional(readOnly = false) public BookTo saveBook(BookTo book) { if (!book.getLibraryId().equals(null)) { LibraryEntity libraryEntity = libraryRepository.getOne(book.getLibraryId()); if (!libraryEntity.equals(null)) { BookEntity entity = BookMapper.map(book); entity.setLibrary(libraryEntity); entity = bookRepository.save(entity); return BookMapper.map(entity); } } return null; }
// @Override @Transactional(readOnly = false) public BookTo saveBook2(BookTo book) { BookEntity entity = BookMapper.map(book); entity = bookRepository.save(entity); return BookMapper.map(entity); }
@Override public List<BookTo> findBooksByTitle(String title) { return BookMapper.map2To(bookRepository.findBookByTitle(title)); }
@Override public List<BookTo> findBooksByAuthor(String author) { return BookMapper.map2To(bookRepository.findBookByAuthor(author)); }
@Override public List<BookTo> findAllBooks() { return BookMapper.map2To(bookRepository.findAll()); }