Persisting Data in the Database
Learn how to persist data in the database.
Overview
Now that our environment is ready, we’ll add a new repository to save the Pomodoro
application data into SQLite. Currently, the application supports only the
inMemory
repository. When we add more repositories, we need to provide a
way for our users to choose how to store data. We can do this at compile
time or runtime.
Providing this choice at runtime makes our application more flexible, allowing users to choose which data store to use for every execution. To do this, we need to compile our application with support for all required data stores and allow the user to choose one, using command-line parameters or configuration options.
Get hands-on with 1200+ tech skills courses.