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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24235078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 09:16:00  来源:igfitidea点击:

Object oriented vs. object relational database difference

databaseobject-oriented-databaseobject-relational-model

提问by ps-aux

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?

面向对象数据库的区别是否也存在于提供对象方法 - 行为(如在 OO 编程语言中)而对象关系数据库仅将它们视为具有属性和对其他对象的引用的结构?如果是这样,如何在 OO 数据库中使用这些对象方法?

采纳答案by usr

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.

这两种类型非常相似:类映射到表。列映射到字段。实例映射到行。对象引用映射到外键。事实上,ORM 试图尽可能接近地映射这两个模型。他们在这方面非常成功。

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 INSERTstatement. The interface is often not SQL.

对象数据库的使用基本上就像在关系数据库之上使用 ORM 一样。您可以直接将对象(或对象图)存储到数据库中,而无需编写INSERT语句。接口通常不是 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.

很难区分这两者,因为它们非常相似。如果您对某些(具体)方面感兴趣,请发表评论。

回答by Kirtiranjan

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.

在面向对象模型中,我们将对象直接存储到数据库中,通过使用这种方法我们可以将图像、视频、音频存储到数据库中。但是在对象关系数据库中,我们将以关系的形式存储数据,也可以直接存储。