由Hibernate填充的POJO是实体,业务对象还是数据传输对象? [英] POJOs populated by Hibernate are entities, business objects or data transfer objects?

查看:184
本文介绍了由Hibernate填充的POJO是实体,业务对象还是数据传输对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



由于这些对象是通过DAO从数据库转移到Business Services的,并且没有任何行为也不持有业务逻辑,他们是DTO。



但是我读过一些文章,他们是商业实体或业务对象,这让我感到困惑。 b
$ b

有人可以澄清不同之处吗?

解决方案

业务实体封装了对于这生意。与封装业务逻辑的控制器相反。控制器实现业务流程并使用实体。



我不会将这些对象称为DTO,因为它们不仅将数据从一个点传输到另一个点。他们创建了一个可以由控制器采取行动的业务模型。

I have classes (POJOs) annotated with JPA and populated by Hibernate.

Since those objects are transfered from database by DAOs to Business Services and doesn't have any behavior nor hold business logics, they are DTOs.

But I have read some articles that they are business entities or business objects and this got me confused.

Can someone clarify the differences?

解决方案

Business Entities encapsulate the data that is important to the business. As opposed to controllers that encapsulate business logic. The controllers implement the business processes and make use of the entities.

I would not call these objects DTOs because they do not only transfer data from one point to the next. They create a model of the business that can be acted upon by the controllers.

这篇关于由Hibernate填充的POJO是实体,业务对象还是数据传输对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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