Objectedorienteddatabaseinstructions Jahlilniles
Objectedorienteddatabaseinstructions Jahlilniles
ENGL 393
Section 4
18 April 2024
information as objects instead of strings or integers. Unlike relation databases, objects in object-
oriented databases can encapsulate data and their behavior. Object-oriented databases are useful
for applications that require complex data structures, like computer aided design (CAD).
performance, better modeling, and scalability. When dealing with complex data relationships,
having a database with high performance is essential and this is where object-oriented databases
real-world objects that are more natural which makes it easier to create these complex systems.
Regarding scalability, object-oriented databases can adjust to the complexity of projects such as
Object-oriented databases are crucial for modelling complex data and they offer
integration with different object-oriented programming languages. Imagine that you have created
a social media app that lets users create posts in addition to liking and commenting on others’
posts. This is where an object-oriented database would come in handy as they can easily handle
relationships between objects. You can have an object for likes, an object for comments, and an
object for posts. With these objects, you can assign difference attributes such as time posted or a
username. Furthermore, after the relationships have been created, they can easily be accessed and
managed. This is why you should choose to create an objected-oriented database over any other
database.
Materials Required for Creating Object-Oriented Databases
IntelliJ, etc. is required to test and develop your database. The programming software you
Pen and paper. You should have something to jot down notes.
Instructions
1. The first step in creating an object-oriented database is planning. Determine what the
a. Some examples include user-defined data types like classes and complex data
a. For example, you can have a one-to-one relationship where one object is related
3. After you identify the type of data and relationship between the data, you can create a
1. After creating your object-oriented database, you must now download an object-
2. Determine which object-oriented database management system you would like to use.
3. If you decide to use ObjectDB, navigate to website shown in the screenshot below
4. After installing ObjectDB, you can either open a database stored on your computer
by clicking “File” then “Open Local” on the top left of your screen.
5. If you would like to open a remote database, and you have the server edition of
ObjectDB, navigate to “File” in the top left and click “Open Remote".
database.
1. After creating your object-oriented database with ObjectDB, you can manage it by using
2. For the following example, we will use java to create a class for an entity to retrieve data
Warning: Your code may not function if you are not using java as mentioned.
3. Firstly, you must import the Entity and ID annotations from the “javax.persistence”
4. Next, create a class named “Person” and mark it as an entity by writing “@Entity” before
it. Following the class, add another annotation “@ID” which makes the ID field in the
5. Now, you must create three private attributes which are “id”, “name”, and “age” which
them.
7. You must then create a public java class for the entity including setters and getters. Name
the class “Person” and include two attributes: “name” and “age”.
8. Congratulations, you successfully made a class. Now to create a query to retrieve data
from this class, start by importing the following packages from “javax.persistence” and
9. After you create the class, you must create an instance named “EntityManagerFactory”
using the Persistence class that you imported from the javax packages. Now comes the
fun part, you need to create another instance named “EntityManager” under the
“EntityManagerFactory” instance.
10. Once this is completed, you need to create a JPQL query that retrieves all “Person”
objects from the database and then stores them in a list as shown below.
Do not forget to
instances at the
Warning: Failure to close the instances at the end of your code can not only lead to performance issues but
the data.
Object: entity that consists of data and operations to manipulate the data
Class: blueprint for creating objects, adding in functions, and assigning attributes
Inheritance: allows for classes in object-oriented databases to inherit attributes from another class
Query: request for data from a database, usually written in SQL or JPQL
JPQL (Java Persistence Query Language): query language used in Java Persistence, specifically
SQL (Structured Query Language): language used to perform tasks like updating data
Sources