简体   繁体   English

面向对象与对象关系数据库的区别

[英]Object oriented vs. object relational database difference

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? 面向对象的数据库是否也给出了对象方法 - 行为(如在OO编程语言中),而对象关系数据库只将它们视为具有属性和对其他对象的引用的结构? If so, how does one uses these object methods in OO databases? 如果是这样,如何在OO数据库中使用这些对象方法?

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. 实际上,ORM尝试尽可能地映射这两个模型。 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. 基本上使用对象数据库就像在关系数据库上使用ORM一样。 You can directly store objects (or object graphs) into the database without the need to write an INSERT statement. 您可以直接将对象(或对象图)存储到数据库中,而无需编写INSERT语句。 The interface is often not SQL. 接口通常不是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. 如果您对某些(具体)方面感兴趣,请发表评论。

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. 但是在Object Relational DB中,我们将以关系的形式存储数据,也可以直接存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM