Layered Domain Model and Object Types in Alibaba Java Development Specification
This article explains the Alibaba Java development specification for layered domain models, detailing the purpose and naming conventions of DO, DTO, BO, AO, VO, Query objects, and further clarifies the roles of PO, VO, DAO, BO, DTO, and POJO in Java backend architecture.
The article introduces the Alibaba Java Development Specification's section on domain models, outlining a layered domain model contract that defines several object types used across different layers of an application.
Layered Domain Model Types:
DO (Data Object) : Directly maps to database tables and is transferred via the DAO layer.
DTO (Data Transfer Object) : Used by Service or Manager layers to transfer data outward.
BO (Business Object) : Encapsulates business logic and is output by the Service layer.
AO (Application Object) : An abstract, reusable object model between the Web and Service layers, closely tied to the presentation layer.
VO (View Object) : Sent from the Web layer to the template rendering engine.
Query : Represents query parameters; queries with more than two parameters must avoid using Map for transfer.
Naming conventions for these objects are also provided:
Data Object: xxxDO where xxx is the table name.
Data Transfer Object: xxxDTO where xxx reflects the business domain.
View Object: xxxVO where xxx usually denotes the page name.
POJO is a generic term for DO/DTO/BO/VO and should not be named xxxPOJO .
The article then details each object type:
1. PO (Persistent Object)
A Java class that maps directly to a database table, often generated with Hibernate.
2. VO (Value Object)
Used for data transfer between business layers; it may correspond to a table or be independent, helping reduce coupling between layers.
3. DAO (Data Access Object)
An interface that abstracts database operations, separating data access logic from business logic. A typical DAO implementation includes a factory class, the DAO interface, a concrete implementation, and a data transfer object.
4. BO (Business Object)
Represents entities that embody business concepts and are managed by service classes.
5. DTO (Data Transfer Object)
Optimized for remote calls or scenarios where only a subset of fields is needed, reducing payload size and hiding internal table structures.
6. POJO (Plain Old Java Object)
Simple JavaBeans without business methods or resource-specific code, often used as value objects or DTOs.
The article concludes by inviting readers to discuss these concepts, share opinions, and join a community of architects for further learning.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.