@Transactional public void update(Author author) { author = this.findById(author.getId()); author.setFirstName(author.getFirstName()); author.setLastName(author.getLastName()); authorRepository.saveAndFlush(author); }
@Transactional public void updatePassword(Author author) { author.setPassword(passwordEncoder.encode(author.getPassword())); authorRepository.saveAndFlush(author); }
public Author findByUsername(String username) { return authorRepository.findByUsername(username); }
public List<Post> findAuthorPosts(Long id) { return postRepository.findByAuthor(authorRepository.findOne(id)); }
public Author findById(Long id) { return authorRepository.findOne(id); }
public List<Author> find() { return authorRepository.findAll(); }
@Transactional public void delete(Long id) { authorRepository.delete(id); }