ddd-by-examples / ddd-by-examples/library
Remove findBy from save at BookRepository.save(Book book)
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 831
- PR merge metrics
- No merged PRs in 30d
Description
@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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at BookRepository.save(Book book) and inspect the findBy call together with the updateOptimistically and insertNew branches. Confirm the resulting save behavior handles existing and new books while preserving optimistic locking, then validate it with the repository's existing test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100