澄清术语:“水合”一个实体:从数据库中获取属性 [英] Clarifying terminology : "Hydrating" an entity : Fetching properties from the DB

查看:94
本文介绍了澄清术语:“水合”一个实体:从数据库中获取属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在实体的ORM /懒惰加载的情况下,我对水合这个词的理解如下:水合描述了填充一些或者使用延迟加载获取的实体的所有以前未填充的属性。例如:class Author 从数据库:

  @Entity 
类作者
{
@Id
长ID;
列表< Book>图书;

最初, books

我的理解是,从数据库加载 books 集合的过程是简称为保湿收藏品。

这个定义是否正确,并且是常用术语?是否还有另一个更常见的术语,我应该用于这个过程? 水解物开始作为填充实例化(特别是在Hibernate中)。

其他各种ORM和工具如BizTalk使用Hydrate和其他相关术语(例如BizTalk使用脱水一词意味着一个实例可用,但尚未填充。)



就我个人而言,我反对冗余术语检修,填充表示同样的事情,没有重新发明语言。它没有增加任何内容,并导致混淆(通常首先想到遇到重新发明的术语:这是不同的和不可思议的?)。 BizTalk这种语言风格的扩展,特别是脱水是多余的。我希望人们没有忘记如何说 清除



Hydrated 及其相关隐喻本质上是营销工具,用于将Hibernate与竞争产品区分开来。



这一点Hibernate和其他ORM产品已经使用这些条款多年,所以水合物(和脱水)在这里停留。


In the context of ORM / Lazy loading of entities, my understanding of the term "Hydration" is as follows:

"Hydrating" describes the process of populating some or all of the previously unpopulated attributes of an entity fetched using lazy loading.

Eg: class Author is loaded from the database:

@Entity
class Author
{
     @Id
     long id;
     List<Book> books;
}

Initially, the books collection is not populated.

It is my understanding that the process of loading the books collection from the database is referred to as "Hydrating" the collection.

Is this definition correct, and is the term common place? Is there another more common term I should be using for this process?

解决方案

Hydrate began as a term for populating an instantiated (but empty) value-object/model from a db, (specifically in Hibernate.)

Various other ORMs and tools like BizTalk use Hydrate and other related terminology, (e.g. BizTalk uses the term Dehydrated to mean an instance is available but not yet populated.)

Personally I'm averse to redundant terminology overhauls, populated means the same thing, without re-inventing language. It adds nothing and leads to confusion (common first thought on encountering re-invented terms: is this somehow different and magical?).

The BizTalk extension of this style of language, specifically Dehydrated is redundant. I expect people haven't forgotten how to say, empty, or clear?

Hydrated and its related metaphors are essentially marketing tools, invented to differentiate Hibernate from competing products.

At this point Hibernate and other ORM products have used these terms for many years, so Hydrate (and Dehydrate) are here to stay.

这篇关于澄清术语:“水合”一个实体:从数据库中获取属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆