hibernateoopentityterminology

POJOs populated by Hibernate are entities, business objects or data transfer objects?


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?


Solution

  • 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.