Chapter 14.  An Object-Relational SQL Example

Oracle documentation refers to Oracle8i’s ability to store user-defined data types in the database as object-relational SQL. I think this is quite appropriate. With Oracle you have the choice of creating three different kinds of tables:

  • A traditional relational table using native SQL data types such as VARCHAR2, DATE, and NUMBER.

  • A relational table with object columns. This type of table is a hybrid, using both native SQL data types and user-defined data types.

  • An object table, which is defined solely based on a user-defined data type.

The best part of this architecture is that it’s flexible enough to facilitate both relational SQL and object-oriented development tools by providing both a relational view and an object view of the same database. You can create object views against relational tables to create an object face to a relational database or create object tables and access the column attributes as though they are part of relational tables by using the TABLE operator. You can have your cake and eat it too!

In this chapter, we’ll discuss the use of JDBC with database objects. We’ll start by examining object analysis and design but not from the traditional point of view. Instead, we’ll look at how we can transform our relational model from that shown in Chapter 8 into an object model. We’ll then look at how we can transform our relational database into an object database by implementing object views on our relational data. We’ll finish ...

Get Java Programming with Oracle JDBC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.