12

I have been reading about database models and still do not understand what are the fundamental differences between object oriented and object relational models.

I learned so far that object relational database is a relational database also which supports objects. What makes object-oriented database different? (aside from not supporting relational model).

Is the difference also in object-oriented database giving the objects methods - behaviour (like in OO programming languages) while object-relational database only treats them as a structures with attributes and references to other objects? If so, how does one uses these object methods in OO databases?

ps-aux
  • 9,706
  • 17
  • 67
  • 117

2 Answers2

12

The two kinds are quite similar: Classes map to tables. Columns map to fields. Instances map to rows. Object references map to foreign keys. In fact, ORMs try to map the two models as closely as possible. They are quite successful with that.

The difference is mostly in the way the database is used. The difference is in "style" and in the patterns that are used.

Object databases are basically used like you would use an ORM on top of a relational database. You can directly store objects (or object graphs) into the database without the need to write an INSERT statement. The interface is often not SQL.

It is hard to differentiate the two because they are so similar. Please leave a comment if you are interested in certain (concrete) aspects.

usr
  • 162,013
  • 33
  • 219
  • 345
  • Q 1: In OO model the database still uses concept of tables? Q 2: What about the objects having certain method. Are there accessors and modifier methods ( I read that all attributes are encapsulated) as well as method like `getPricer()` which would first calculate price and then return it? Q3: What is an example of interface for OO databases? – ps-aux Jun 16 '14 at 06:42
  • In OO model it does not call it tables but classes. Not every OO database has this notion.; The database stores data, not code. If you retrieve an object instance that happens to have methods defined then those methods will be available on that object. If you change the methods available through recompilation the new methods will be available on the next program run.; db4o is an example project that I have used. http://www.db4o.com/ – usr Jun 16 '14 at 09:30
3

In an object oriented model we will directly store the object into a DB, by using this method we can store the images, videos,audio into a DB. But in Object Relational DB we will store the data in the form of a relation and also in directly.

John Hascall
  • 8,682
  • 4
  • 46
  • 64
Kirtiranjan
  • 45
  • 1
  • 9