0% found this document useful (0 votes)
90 views9 pages

Objectedorienteddatabaseinstructions Jahlilniles

Uploaded by

api-750792833
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views9 pages

Objectedorienteddatabaseinstructions Jahlilniles

Uploaded by

api-750792833
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Jahlil Niles

ENGL 393

Section 4

18 April 2024

How to Create Object-Oriented Databases


How to Create Object-Oriented Databases
Object-oriented databases (OODBs) are a form of database management system that store

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).

There are many benefits associated with objected-oriented databases such as

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

outshine relationship databases. Having good modeling permits designing representations of

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

using inheritance, object query language, polymorphism, and object relationships.

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

 Programming software. A programming software such as Visual Studio, MATLAB,

IntelliJ, etc. is required to test and develop your database. The programming software you

select depends on which programming language you intend to use.

 Database Management System. A database management system, such as ObjectDB, is

important for creating and storing data of your object-oriented database.

 Documentation. Refer to documentation related to your programming language to know

what functions or methods apply.

 Pen and paper. You should have something to jot down notes.
Instructions

Phase 1: Planning Your Object-Oriented Database

1. The first step in creating an object-oriented database is planning. Determine what the

purpose of your object-oriented database will serve.

Phase 2: Designing Your Objected-Oriented Database


1. Determine the type of data you would like to store. ex. Storing information related to

patients such as age, weight, height, etc.

a. Some examples include user-defined data types like classes and complex data

types such as arrays, sets, or dates.

2. Identify the relationships of the data you would like to store.

a. For example, you can have a one-to-one relationship where one object is related

to another or a many-to-one relationship where multiple objects are related to

exactly one object.

3. After you identify the type of data and relationship between the data, you can create a

conceptual model using an entity-relationship diagram.

4. Once you have made a

conceptual model, you can

then create a logical model

where you outline methods,

classes, and much more.

Figure 1. Image of an Entity Relationship Diagram. (Visual Paradigm)


Phase 3: Implementing Your Object-Oriented Database

1. After creating your object-oriented database, you must now download an object-

oriented database management system.

2. Determine which object-oriented database management system you would like to use.

a. Some management systems include db4o, ObjectStore, and ObjectDB

3. If you decide to use ObjectDB, navigate to website shown in the screenshot below

and download and install the software to your computer.

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".

6. To close your database,

simply click “File” in the top

left and then “Close” which

will either close the local

database you opened or end

the connect to the remote

database.

Figure 2. Image of ObjectDB Explorer. (ObjectDB)


Phase 4: Managing Your Object-Oriented Database

1. After creating your object-oriented database with ObjectDB, you can manage it by using

SQL or query language specific to object-oriented database management systems.

2. For the following example, we will use java to create a class for an entity to retrieve data

from the ObjectDB database.

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”

package into your code as shown on the first two lines.

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

primary class the primary key.

5. Now, you must create three private attributes which are “id”, “name”, and “age” which

are defined in the Person class.

6. After you create the

attributes, you must

now create setters and

getters which allow

other classes to access

the “name” and “age”

attributes and modify

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

create a new class titled “Main”.

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.

11. Finally, create a

print function that

prints the data

stored in the list.

Do not forget to

close the two

instances at the

end of your code.

Warning: Failure to close the instances at the end of your code can not only lead to performance issues but

also memory leaks.


Glossary
Encapsulation: when objects in code are combined, which increases the security and integrity of

the data.

Object: entity that consists of data and operations to manipulate the data

Attribute: a quality or characteristic of an object

Class: blueprint for creating objects, adding in functions, and assigning attributes

Instance: object which is created from a class

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

for Java objects

SQL (Structured Query Language): language used to perform tasks like updating data
Sources

Dictionary.com. (n.d.). Dictionary.com. https://www.dictionary.com/

What is Entity Relationship Diagram (ERD)?. Visual Paradigm. (n.d.). https://www.visual-


paradigm.com/guide/data-modeling/what-is-entity-relationship-diagram/

[ODB1] Chapter 9 - ObjectDB Explorer. ObjectDB. (n.d.).


https://www.objectdb.com/database/jdo/manual/chapter9

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy