This project demonstrates the use of db4o (database for objects) to handle database operations in Java.
It involves creating persistent objects, performing CRUD (Create, Read, Update, Delete) operations, and executing queries on a db4o database.
The project showcases an understanding of object-oriented programming and the practical implementation of a lightweight object database in Java.
The primary goals of this project are to:
- Implement Java classes and make them persistent by storing them in a db4o database.
- Demonstrate the ability to:
- Insert objects into the database.
- Modify objects in the database.
- Retrieve objects using different query mechanisms (QBE, SODA).
- Delete objects from the database.
The project implements the following:
-
Persistent Objects:
DegreeProgram: Represents a degree program with attributes likedegreeName,department, andfaculty.Student: A base class for students with attributes likedegreeProgram,studentNumber,name, andsurname.Undergraduate: A subclass ofStudentwith additional attributesyearOfStudyandaverageMark.Postgraduate: A subclass ofStudentwith additional attributessupervisorInitials,supervisorSurname, andresearchTopic.
-
CRUD Operations:
- Add new degree programs, undergraduate, and postgraduate students.
- List all students (undergraduate and postgraduate).
- Search for students using QBE (Query by Example) and SODA (Simple Object Database Access).
- Update student details (depending on their type).
-
Database File:
- Persistent storage is handled using
database.db4o.
- Persistent storage is handled using
- Application: Contains the
.jarfile and other executable files. - Source: Contains all
.javasource code files.
Database.java: Handles database operations such as adding, retrieving, updating, and deleting objects.Tester.java: Contains the main menu-driven interface for interacting with the application.DegreeProgram.java: Defines the degree program structure.Student.java: Base class for students.Undergraduate.java: Subclass for undergraduate students.Postgraduate.java: Subclass for postgraduate students.
database.db4o: The db4o database file used for storing persistent objects.
- Compile all
.javafiles in the Source folder. - Execute the
Testerclass to launch the menu-driven application. - Interact with the application using the following menu options:
- Add degree program.
- Add undergraduate student.
- Add postgraduate student.
- List all students.
- Find postgraduate student (QBE).
- Find undergraduate student (QBE or SODA).
- Update student.
- Java: Programming language used for implementation.
- db4o: Object-oriented database for Java.
- Eclipse/JetBrains Rider/IntelliJ IDEA: (optional) IDE for development and testing.