-
Notifications
You must be signed in to change notification settings - Fork 0
Database
Introduction
Recordian uses an SQLite database. My first intuition was to solely use a simple flat file database, such as a text file, for the entire application. I later realized that I wanted a database with a little more flexibility when I took into consideration the fact that Recordian will keep track of the locations where a user works, the companies which they work for, and the supervisors whom they work under. The database would need to be able to: store various locations/companies/supervisors, retrieve any one of them on command, create new ones, update existing ones, and delete old ones. I knew I needed the database to be serverless while still carrying the benefits that a relational database has. So, upon further research, I settled on using an SQLite database.
Note: Up until Version 3, a flat file database was used for recording log entries. Since Version 3, log entries have been stored in the database along with locations, companies, and supervisors.
Object Relational Mapping
Converting between Java classes and database records is a common problem that Java developers encounter when making use of a relational database in their application. I chose to implement object relational mapping in order to solve this problem. I considered using an existing ORM such as Hibernate, but very few ORMs support an SQLite database. The majority of ORMs that do support SQLite are dedicated to Android applications. Consequently, their API documentation is tailored toward the Android framework. Ultimately, I decided to create my own Java classes that map between Java objects and relational database records.