Solving Relational Database Problems With ORDBMS in An Advanced Database Course
Solving Relational Database Problems With ORDBMS in An Advanced Database Course
Solving Relational Database Problems With ORDBMS in An Advanced Database Course
September 2011
Teaching Case
Ming Wang
ming.wang@calstatela.edu
Department of Information Systems
California State University
Los Angeles, CA 90032
Abstract
This paper introduces how to use the object-relational database management system (ORDBMS) to
solve relational database (RDB) problems in an advanced database course. The purpose of the paper
is to provide a guideline for database instructors who desire to incorporate the ORDB technology in
their traditional database courses. The paper presents how to use the specific object-relational
database (ORDB) technology to solve three normalization problems: Transitive dependency, Multi-
value attributes, and Non-1st Normal Form. The paper also provides the solutions to data complexity
problems with three specific ORDBMS techniques: object view, object inheritance, and object
integration. The paper summarizes the significance and advantages of teaching ORDBMSs in advanced
database courses. Course contents and students’ learning outcomes are discussed. To be more helpful
to database educators, the paper presents a complete object-relational database development case
study from the UML class diagram design to Oracle ORDBMS implementation.
The purpose of the paper is to provide a guide limited inroads during the 1990’s, but have since
for database instructors who desire to been dying off. Instead of a migration from
incorporate the ORDB technology in their relational to object-oriented systems, as was
traditional database courses. This paper widely predicted around 1990, the vendors of
presents how to use ORDBMS to overcome relational systems have incorporated many
relational database weaknesses and solve some object-oriented database features into their
existing normalization problems. The paper first DBMS products. As a result, many DBMS
introduces the background and features of products that used to be called “relational” are
ORDBMS, then presents how to use the specific now called “object-relational.” (Garcia-Molina,
ORDBMS techniques to solve normalization et al. 2003).
problems in 1) Transitive dependency, 2) Multi-
value attributes, 3) and Non-1st Normal Form, Practically, ORDBMS bridges the gap between
and how to use the specific ORDBMS features: OODBMS and RDBMS by allowing users to take
1) object view 2) object inheritance and 3) advantage of OODB'MSs great productivity and
object integration to solve data complexity complex data type without losing their existing
problems. Course content and students’ learning investment in relational data (Connolly & Begg,
outcomes are discussed. Many of the ORDBMS 2006). In fact, an ORDBMS engine supports both
features appear in Oracle. Thus, the author relational and object-relational features in an
utilizes Oracle as a tool to demonstrate how to integrated fashion (Frank, 1995). The underlying
overcome some weaknesses of relational DBMS. ORDB data model is relational because object
The ORDBMS script in the case study has been data is stored in tables or columns. ORDB
tested in the Oracle 9i, 10g, and 11g SQLPlus designers can work with familiar tabular
environment. The solution to the presented case structures and data definition languages (DDLs)
can be utilized in the classroom demonstration while assimilating new object-oriented features
and can also be generalized the homework (Krishnamurthy et al., 1999).It is essentially a
assignments and projects of advanced database relational data model with object-oriented
courses. extensions. In response to the evolutional
change of ORDB technology, SQL:1999 started
2. ORDB TECHNOLOGY supporting object-relational data modeling
features in database management
The object-relational database technology standardization and SQL:2003 continues this
occurrence can be traced back to the middle of evolution. Currently, all the major database
1990s after emergence of object-oriented vendors have upgraded their relational database
database (OODB). In their book “Object- products to object-relational database
relational DBMSs: the Next Great Wave”, management systems to reflect the new SQL
Stonebraker and Moore (1996) define their four- standards (Hoffer et al., 2009) and use by
quadrant view (two by two matrix) of the data industrial practitioners.
processing world: relational database, object-
relational database, data file processing, and Although each of the object-relational DBMS
object-oriented database. Their purpose is to vendors has implemented OO principles:
indicate the kinds of problems each of four- encapsulation and inheritance in their own way,
quadrants solves. As will be seen, "one size does all of them share the combination of the OO
not fit all"; i.e. there is no DBMS that solves all principles and follow SQL standardization,
the applications. They suggest that there is a incorporate object-oriented paradigms. All the
natural choice of data manager for each of the ORDBMSs have the ability to store object data
four database applications. They conclude why and methods in databases. Many of the
the problems addressed by object-relational SQL:2003 standard ORDBMS features appear in
DBMSs are expected to become increasingly Oracle. These features are listed as follows.
important over the next decade. As such, it is
"the next wave". Object Types: User-defined data types (UDT)
or abstract types (ADT) are referred to as object
Theoretically, as Stonebraker and Moore (1996) types.
predict in their four-quadrant view of the
database world, ORDBMS has been the most Functions/Methods: For each object type, the
appropriate DBMS that processes complex data user can define the methods for data access.
and complex queries. The object-oriented Methods define the behavior of data.
database management systems have made
Varray: The varray is a collection type that maintenance cost, reduce the defect rate, and
allows the user to embed homogenous data into raise the applications’ reliability. If multiple
an array to form an object in a pre-defined array database applications use the same set of
data type. database objects in ORDBMS, a de facto
standard for the database objects is created,
Nested table: A nested table is a collection type and these objects can be extended, reused and
that can be stored within another table. With a integrated in the ORDB.
nested table, a collection of multiple columns
from one table can be placed into a single 3. CASE STUDY
column in another table.
3.1 Case Scenario
Inheritance: With Object type inheritance,
users can build subtypes in hierarchies of Pacific Bike Traders assembles and sells bikes to
database types in ORDBs. customers. The company currently accepts
customer orders online and wants to be able to
Object View: Object view allows users to track orders and bike inventory. The existing
develop object structures in existing relational database system cannot handle the current
tables. It allows data to be accessed or viewed transaction volume generated by employees
in an object-oriented way even if the data are processing incoming sales orders. When a
really stored in a traditional relational format. customer orders a bike, the system must
confirm that the ordered item is in stock. The
There is some research that has been done in system must update the available quantity on
ORDBMS technology as ORDBMSs have become hand to reflect that the bike has been sold.
commonplace in recent years. He and Darmont When Pacific Bike Traders receives new
(2005) propose the Dynamic Evaluation shipments, a receiving clerk must update the
Framework (DEF) that simulates access pattern inventory to show the new quantity on hand.
changes using configurable styles of change. The system must produce invoices and reports
Pardede, Rahayu, & Taniar (2006) propose an showing inventory levels.
innovative methodology to store XML data into
new ORDB data structures, such as user-defined 3.2. Business Rules
type, row type and collection type. The
methodology has preserved the conceptual The following business rules are developed for
relationship structure in the XML data, including the new database system:
aggregation, composition and association. Wok
(2007) and Cho, et. al. (2007) present a One customer may originate many orders.
methodology for designing proper nesting One order must be originated from a customer.
structures of user-defined types in object-
relational database. The proposed schema trees One order must contain one or more bikes.
schema are transformed to Oracle 10g. Their One bike may be in many orders.
purpose is to develop an automatic ORDB design
tool. One employee may place many orders.
One order must be placed by an employee.
But very little research has been done in using
ORDBMS to overcome relational database One bike is composed with a front wheel, rear
weaknesses and solve some existing wheel, crank, and stem.
normalization problems. The significance of the One front wheel, rear wheel, crank, and stem
paper is to promote teaching ORDBMS features compose one bike.
for problem solving and object reuse and
integration among IS educators. The use of One employee must be either a full-time or part-
ORDBMSs to develop database applications can time.
enforce the reuse of varying user-defined object One full-time or part-time employee must be an
types, provide developers’ an integrated view of employee.
data and allow multiple database applications to
operate cooperatively. Ultimately, this can 3.2. ORDB Design
result in improved operational efficiency for the
IT department, increase programmers’ The Pacific Trader Object-Relational Database
productivity, lower development effort, decrease design is illustrated with the UML class diagram
in Appendix 1. Each of the classes is displayed Normalization Form (3NF) rule because there is
as a rectangle that includes three sections: the the transitive dependency in the customer table.
top section gives the class name; the middle Zip is a determinant of street, city and state.
section displays the attributes of the class; and Functional dependency analysis shows transitive
the last section displays methods that operate dependency:
on the data in the object. Associations between
classes are indicated with multiplicity Zip -> Street, City, State (transitive dependency)
(“min..max.” notation). Inheritance is indicated
with an empty triangle. Aggregation is marked There are three solutions to this transitive
with an empty diamond, whereas composition is dependency problem. Solution 1 keeps the
marked with a solid diamond. Aggregation customer table in the Second Normalization
models a whole-part relationship where Form (2NF) though it is not an ideal normal form
individual items become elements in a new for a relational database.
class. In Appendix 1, a sales order is made of
line items (bikes). Aggregation is indicated by a Solution 2 is to create a new customer address
small empty diamond next to the SalesOrder table by splitting the address from the original
class. The dotted line links to the associative customer table (3NF). This solution implies more
class generated from the many-to-many joins of records in the Customer table and Zip
relationship. table.
Object types need to be defined before the 4.2 Varray and Multi-value Attributes
customer table. The following SQL statements
define the object types: address_ty and In a relational model, multi-valued attributes
name_ty. are not allowed in the first normalization form.
The traditional solution to the problem is that
CREATE OR REPLACE TYPE address_ty AS each multiple-valued attribute is handled by
OBJECT forming a new table in a relational database. If a
(street NVARCHAR2(30), table has five multi-valued attributes, that table
city VARCHAR2(25), would have to be split into six tables. The Oracle
state CHAR(2), ORDBMS allows users to create the varying
zip NUMBER(10)); length array (VARRAY) data type as a new data
storage method for multi-valued attributes. The
CREATE OR REPLACE TYPE name_ty AS OBJECT following statement defines a varray type of
( three VARCHAR2 string named varray_phone_ty
f_name VARCHAR2(25), to represent a list of phone numbers.
l_name VARCHAR2(25));
VARRAY is a collection type in ORDBMSs. A
Mapping the above customer class, the following VARRAY consists of a set of objects that have
statement is used to create the Customer table the same predefined data type in an array. In a
with the CustName and CustAddress object relational model, multi-valued attributes are not
columns using name_ty and address_ty. The allowed in the first normalization form. The
column phone is to be added to the table later. solution to the problem is that each multiple-
valued attribute is handled by forming a new
CREATE TABLE Customer2( table. If a table has five multi-valued attributes,
Cust_ID Number(5), that table would have to be split into six tables
CustName name_ty, after the First Form of normalization. To retrieve
CustAddress address_ty); the data back from that original table, the
student would have to do five joins across these
Object type constructors are used to insert six tables. ORDBMs allow multi-valued attributes
object data into the table. The following INSERT to be represented in a database. ORDBMSs allow
statement uses constructors name_ty() and users to create the varying length array
address_ty() to add data into the two object (VARRAY) data type can be used as a new data
columns. storage method for multi-valued attributes. The
following statement defines a VARRAY type of
INSERT INTO Customer VALUES (1, three VARCHAR2 strings named
name_ty ('John', 'Smith',), varray_phone_ty to represent a list of three
address_ty ('12 Road', 'Bell', 'CA', 90201)); phone numbers in the Customer2 table.
The following statements retrieve the data from CREATE TYPE varray_phone_ty AS VARRAY(3)
the Customer2 table. OF VARCHAR2(14);
Users might want to define a full time employee CREATE TYPE full_time_ty UNDER employee_ty (
object type and have that type inherit existing Salary NUMBER(8,2));
attributes from employee_ty. The full_time_ty
type can extend employee_ty with attributes to CREATE TABLE FullTimeEmp of full_time_ty;
store the full time employee’s salary. The
part_time_ty type can extend employee_ty with The preceding statement creates full_time_typ
attributes to store the part-time employee’s as a subtype of employee_typ. As a subtype of
hourly rates and wages. Inheritance allows for employee_ty, full_time_ty inherits all the
the reuse of the employee_ty object data type. attributes declared in employee_ty and any
The details are illustrated in the following class methods declared in employee_ty. The
diagram: statement that defines full_time_ty specializes
employee_ty by adding a new attribute “salary”.
New attributes declared in a subtype must have
Employee
-<PK> emp_id : Integer
names that are different from the names of any
-name : Object attributes or methods declared in any of its
-address : Object
-phone : Object
supertypes, higher up in its type hierarchy. The
+getEmployee() following example inserts row into the
FullTimeEmp table. Notice that the additional
salary attribute is supplied
student_part_time _ty under part_time_ty. The Object-types possess all the properties of a
new subtype inherits all the attributes and class, data abstraction, encapsulation,
methods of student_part_time _ty and adds two inheritance and polymorphism. These traits of
attributes. object-types are embedded in the relational
nature of the database; data model, security,
CREATE TYPE student_part_time_ty UNDER concurrency, normalization. In more precise
part_time_ty words, the underlying ORDB data model is
(school VARCHAR2(20), relational because object data is stored in tables
year VARCHAR2(10)); or columns.
ORDBMS combines attributes and methods The provided ORDB script guides students with
together in the structure of object type. The hands-on learning experience in the classroom.
object type interface includes both attributes Once they have understood they can use the
and its methods. The public interface declares script as templates to do their homework
the data structure and the method header shows assignments and projects. ORDB, implement it
how to access the data. This public interface with Oracle 9i/10g, and create ORDB
serves as an interface to applications. The applications using various tools. As a result, the
private implementation fully defines the following learning outcomes are demonstrated at
specified methods. the end of the class. Students are able to:
He, Z., & Jérôme, D. (2005). Evaluating the Rahayu, J. W., Taniar, D. And Pardede, E.
Dynamic Behavior of Database Applications, (2005) Object-Oriented Oracle, IRM Press
Journal of Database Management; 16:2, 21-
45. Silberschatz, A., Korth, H. and Sudarshan, S.
2009, Database System Concepts, Six
Hoffer, J., Prescott, M., & Topi, H., 2009 Modern Edition, McGraw-Hill
Database Management, 9th Edition, Pearson
Prentice Hall. Stonebraker M. and Moore, D. 1996. Object-
relational DBMSs: the Next Great Wave. San
Krishnamurthy, Banerjee and Nori, 1999. Francisco, CA: Morgan Kaufmann Publishers,
Bringing object-relational technology to the Inc.