澄清术语-什么是“水合"?从数据库中获取实体时,JPA或Hibernate实体的意思是 [英] Clarifying terminology - What does "hydrating" a JPA or Hibernate entity mean when fetching the entity from the DB

查看:118
本文介绍了澄清术语-什么是“水合"?从数据库中获取实体时,JPA或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.

例如:从数据库中加载类Author:

Eg: class Author is loaded from the database:

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

最初,不会填充books集合.

据我了解,从数据库加载books集合的过程称为水合"集合.

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最初是从db(特别是在Hibernate中)填充实例化(但为空)的值对象/模型的术语.

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

诸如BizTalk之类的各种其他ORM和工具都使用Hydrate和其他相关术语,例如BizTalk使用脱水"一词来表示实例可用但尚未填充.

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?).

这种语言的BizTalk扩展,特别是脱水是多余的.我希望人们不会忘记怎么说 还是 清晰 ?

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 及其相关的隐喻本质上是营销工具,旨在将Hibernate与竞争产品区分开来.

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

在这一点上,Hibernate和其他ORM产品已经使用了这些术语很多年了,因此水合物(和脱水)仍然存在.

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

这篇关于澄清术语-什么是“水合"?从数据库中获取实体时,JPA或Hibernate实体的意思是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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