Object-Relational Database system - Oracle DBA

An object-relational database system supports everything a relational database system supports, as well as constructs for object-oriented development and design techniques. Object-oriented constructs are found in modern programming languages such as Java and C++. Both Oracle9i and Oracle 10gfully support all of the traditional object-oriented constructs and methods.

Object-Relational Database A relational database that includes additional operations and components to support object-oriented data structures and methods.

While the full range of object-oriented techniques is beyond the scope of this book, you will get a good idea of some of the object-oriented capabilities of Oracle, including abstraction, methods, encapsulation, and inheritance. Let's define those terms now.

Abstraction

One of the ways in which Oracle supports the object-relational model is by using abstraction. As noted earlier, Oracle has many built-in datatypes, such as numeric, string, date, and others. In addition, you can define user-defined objects as an aggregate of several other datatypes. These new user-defined types are called abstract datatypes

Abstract Datatypes New datatypes, usually user-created, that are based on one or more built-in datatypes and can be treated as a unit.

For example, when Scott's widget company grows, there may be other systems where he needs to represent an employee or a customer, or in more general terms, a person. Scott can define a datatype called PERSON that stores a first name, last name, middle initial, and gender. When the new customer tables are being built, Scott just needs to use the new PERSON type in the table definition. This brings to the table two immediate benefits: reusability and standards. Creating the new table is faster, since the data type has already been defined, and it's less error prone than creating four individual fields. In addition, any developer who moves from an employee-oriented project to a customer-oriented project at Scott's company will find familiarity in common objects and naming conventions.

Methods and Encapsulation

Another way in which object-oriented techniques are reflected in the Oracle object-relational database is through the use of methods and encapsulation. Methods define which operations can be performed on an object. Encapsulation restricts access to the object other than via the defined methods.

Methods Operations on an object that are exposed for use by other objects or applications.

Take a simple example of an employee object: It contains characteristics such as the employee name, address, and salary. A method against an employee object might be to get the name or change the name. Another method might be to increase the salary but never to decrease the salary. The encapsulation of the employee object prevents the direct manipulation of the characteristics of an employee object other than what the methods, driven by business rules, dictate.

Encapsulation An object-oriented technique that may hide, or abstract, the inner workings of an object and expose only the relevant characteristics and operations on the object to other objects.

Inheritance

Inheritance allows objects that are derived from other objects to use the methods available in the parent object. If a new object is created with an existing object as a base, all of the methods available with the existing object will also be available with the new object.

Inheritance Acquiring the properties of the parent, or base object, in a new object.

For example, if Scott were to implement a new EMPLOYEE type and a new CUSTOMER type using the PERSON type as the base, then any methods that already exist for PERSON would be available when using one of the two new types. The method ChangeLastName, defined with the PERSON type only once, can be used with objects defined with the CUSTOMER or EMPLOYEE type.

Object-Relational Support

Oracle Database 10g provides additional features to ease the transition to an object-oriented database application. Object views allow the developer to define an object-oriented structure over an existing relational database table. In this way, existing applications do not need to change immediately, and any new development can use the object-oriented definitions of the table. This makes the transition from a relational to an object-relational database relatively painless, because object definitions can reference existing relational components.

Object View A database construct that overlays an object-oriented structure over an existing relational database table. As a result, the table can be accessed as a relational table or as an object table and make the transition to a fully object-oriented environment easier.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle DBA Topics