0% found this document useful (0 votes)
4 views9 pages

Java Objects

The document outlines the object flow in a Java MVC/J2EE architecture, detailing the interaction between various layers including the View, Controller, Service, DAO, Persistence, and Database layers. It describes how data is transformed from user input into Data Transfer Objects (DTOs), Business Objects (BOs), and Entities, as well as the reverse flow of data back to the user. Additionally, it highlights the roles of server-side components like EJBs in managing business logic and data persistence.

Uploaded by

navabnavab786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Java Objects

The document outlines the object flow in a Java MVC/J2EE architecture, detailing the interaction between various layers including the View, Controller, Service, DAO, Persistence, and Database layers. It describes how data is transformed from user input into Data Transfer Objects (DTOs), Business Objects (BOs), and Entities, as well as the reverse flow of data back to the user. Additionally, it highlights the roles of server-side components like EJBs in managing business logic and data persistence.

Uploaded by

navabnavab786
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Object Flow from View Layer → Database Layer (Bidirectional)

Layer Component Object In Object Out Conversion


View Layer JSP / UI — DTO User input converted to DTO
Controller Layer Servlet / Controller DTO DTO Pass DTO to service
DTO → BO (business
Service Layer Service Class DTO BO
processing)
Service Layer Business Logic BO DTO / VO BO → DTO or VO (result)

Persistence Layer DAO / Repository DTO Entity DTO → Entity

Database Layer Database Entity Table Record Entity stored in table

Reverse Flow (Database → View)

Layer Component Object In Object Out


Database Layer Database Table Record Entity
Persistence Layer DAO Entity DTO
Service Layer Service DTO VO / DTO
Controller Layer Servlet DTO DTO
View Layer JSP DTO / VO Display Data

Master Table: Layers vs Components vs Objects vs Technologies (Java MVC / J2EE)


Layer Components Objects Used Technologies

View / Presentation Layer JSP, HTML Pages, UI Templates DTO, VO JSP, HTML, CSS, JavaScript

Controller Layer Servlet, Front Controller DTO Java Servlet API

Service / Business Layer Service Classes, Business Components BO, DTO, VO Core Java, Spring Framework

Persistence Layer DAO, Repository Entity Objects JDBC, JPA, Hibernate

Tables,
Database Layer Database Server MySQL, Oracle, PostgreSQL
Records

Request Flow (User → Database)

Layer Input Object (I) Component Output Object (O)


View Layer User Form Data JSP / HTML DTO
Layer Input Object (I) Component Output Object (O)
Controller Layer DTO Servlet / Controller BO
Service Layer BO Service Class BO
DAO Layer BO DAO / Repository VO
Persistence Layer VO ORM (JPA / Hibernate) Entity
Database Layer Entity RDBMS Table Records

Response Flow (Database → User)

Layer Input Object (I) Component Output Object (O)


Database Layer SQL Query RDBMS Entity
Persistence Layer Entity ORM (JPA / Hibernate) VO
DAO Layer VO DAO / Repository BO
Service Layer BO Service Class BO
Controller Layer BO Servlet / Controller DTO
View Layer DTO JSP / HTML HTML Response

Simple Object Flow


View
I: Form Data
O: DTO

Controller
I: DTO
O: BO

Business
I: BO
O: BO

DAO
I: BO
O: VO

Persistence
I: VO
O: Entity

Database
I: Entity
O: Records
Layer Input Object Component Output Object
View Layer User Form Data JSP / HTML DTO
Controller Layer DTO Servlet / Controller BO
Business Layer (Service) BO Service Class BO
DAO Layer BO DAO / Repository VO
Persistence Layer VO ORM / Entity Manager Entity
Database Layer Entity RDBMS Table Records

Reverse Flow (Response)

Layer Input Object Component Output Object


Database Layer SQL Query RDBMS Entity
Persistence Layer Entity ORM VO
DAO Layer VO DAO / Repository BO
Business Layer BO Service Class BO
Controller Layer BO Servlet / Controller DTO
View Layer DTO JSP / UI HTML Response

Components Managed by Server in MVC / J2EE Layers

Layer Component Managed By Server


View Layer JSP Web Server / Servlet Container
Controller Layer Servlet, Spring Controller Servlet Container
Business Layer Service Classes Application Server / Spring Container
DAO Layer DAO / Repository Application Server / Spring Container
Layer Component Managed By Server
Persistence Layer Entity Classes / ORM Persistence Provider
Database Layer Tables, Procedures Database Server

Servers managing components

Server Components Managed


Web Server / Servlet Container JSP, Servlets, Controllers
Application Server Service Classes, DAO Components
Persistence Provider Entities, ORM Mapping
Database Server Tables, Records

MVC / J2EE – Master Table

Input Output Object


Layer Components Object Type
(I) (O) Mapping
User
View Layer JSP, HTML, CSS, View Form Object →
Form DTO External
(Presentation) Templates DTO
Data
Controller Layer Boundary
Servlet, Spring
(Web / Front DTO BO (External → DTO → BO
Controller
Controller) Internal)
Service Interface, Service BO → BO
Business Layer
Implementation, BO BO Internal (Business
(Service Layer)
Validator, Manager Processing)
DAO Interface, DAO
DAO Layer (Data
Implementation, BO VO Internal BO → VO
Access Layer)
Repository
Persistence Layer
Entity Classes, ORM
(ORM / Entity VO Entity Internal VO → Entity
Mapper
Layer)
Table Entity →
Database Layer Tables, Records Entity Internal
Records Database

Reverse Flow (Database → User)

Layer Input (I) Output (O) Object Type Object Mapping


Database Layer Table Record Entity Internal Table → Entity
Persistence Layer Entity VO Internal Entity → VO
DAO Layer VO BO Internal VO → BO
Business Layer BO BO Internal BO → BO
Layer Input (I) Output (O) Object Type Object Mapping
Controller Layer BO DTO Boundary BO → DTO
View Layer DTO / Model HTML Response External DTO → View

External Objects (UI → Controller)


User
↓ Form Object
View Layer
↓ DTO
Controller Layer

Internal Objects (Controller → Database)


Controller Layer
↓ BO
Business Layer
↓ BO
DAO Layer
↓ VO
Persistence Layer
↓ Entity
Database

Return Flow (Database → User)


Database
↓ Entity
Persistence Layer
↓ VO
DAO Layer
↓ BO
Business Layer
↓ BO
Controller Layer
↓ DTO
View Layer
↓ HTML Response
User

MVC / J2EE – Master Chart

Output Object Mapping /


Layer Components Input (I) Object Type
(O) Flow
View Layer User Form
JSP, HTML, CSS, JS DTO External Form Object → DTO
(Presentation) Data
Controller Layer Servlet, Spring DTO BO Boundary DTO → BO
(Web / Front Controller (External →
Output Object Mapping /
Layer Components Input (I) Object Type
(O) Flow
Controller) Internal)
Service Interface,
Business Layer Service BO → BO (Business
BO BO Internal
(Service Layer) Implementation, Logic)
Validator, Manager
DAO Interface, DAO
DAO Layer (Data
Implementation, BO VO Internal BO → VO
Access Layer)
Repository
Persistence Layer
Entity Classes, ORM
(ORM / Entity VO Entity Internal VO → Entity
Mapper
Layer)
Tables, Views, Stored Table
Database Layer Entity Internal Entity → Database
Procedures Records

Reverse Flow (Database → User)

Layer Input Output Object Type Object Mapping


Database Table Record Entity Internal Table → Entity
Persistence Entity VO Internal Entity → VO
DAO VO BO Internal VO → BO
Business BO BO Internal BO → BO
Controller BO DTO Boundary BO → DTO
View DTO / Model HTML Response External DTO → View

Yes, it is accurate to say that the model layer in enterprise software architecture often
encompasses the business layer logic and is frequently implemented using server-side
components like Enterprise JavaBeans (EJBs).
The role of the model in software design, particularly in architectures like Model-View-
Controller (MVC), is to manage the application's data, logic, and rules independently of the user
interface.
Role of the Model and EJBs

Business Logic Implementation: EJBs (specifically Session Beans) are server-side components
designed to encapsulate and execute the core business logic, such as transaction handling,
security, and persistence. This allows developers to focus on the business rules without
managing underlying system-level services.

Data Representation: The model also includes data storage and persistence mechanisms. In the
context of Java EE and EJB, this part is often handled using the Java Persistence API (JPA) and
entity classes (which replaced older Entity Beans).

Server-Side Components: EJBs are managed by an EJB container within an application server,
providing a robust, scalable, and distributed environment for enterprise applications. This aligns
perfectly with the "server-side components implementation" part of your definition.
Separation of Concerns
In a well-architected application, different components handle specific responsibilities to ensure
maintainability and scalability

Model: Handles business logic and data (implemented by EJBs, JPA entities).
View: Handles the presentation layer (e.g., JSF, JSP, HTML).
Controller: Manages user input and mediates between the view and the model (e.g., Servlets,
JSF Managed Beans).
 DAO Layer → Handles data access operations (CRUD)

 Persistence Layer → Handles object–relational mapping (ORM) between Java objects and
database tables.

You might also like