Repository
On This Lesson 4 topics
The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.
In this lesson
hide storage behind a collection-like interface.
Planned topics
- Problem: domain code should not know about SQL or files.
- A repository offers
findById,save,findAll. - Domain code uses the interface; storage code implements it.
- In tests, use an in-memory version.
- Spring Data uses this idea.
Draft outline details
Demonstration
interface ProductRepository {
Optional<Product> findBySku(Sku sku);
void save(Product p);
}Check your understanding
What does a repository hide?
Show answer
How and where data is stored.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.