library icon indicating copy to clipboard operation
library copied to clipboard

Remove findBy from save at BookRepository.save(Book book)

Open pilloPl opened this issue 4 years ago • 0 comments

 @Override
    public void save(Book book) {
        findBy(book.bookId())
                .map(entity -> updateOptimistically(book))
                .onEmpty(() -> insertNew(book));
    }

this findBy is only there to have updateOrCreate behavior. But it makes optimistic locking doesn't work. in FindBy we fetch new Version

pilloPl avatar Mar 19 '20 14:03 pilloPl