JavaBeans

A JavaBean is a class that follows the JavaBeans conventions as defined by Sun. Wikipedia has a pretty good summary of what JavaBeans are:

JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a Java Object that is serializable, has a nullary constructor, and allows access to properties using getter and setter methods.

In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.

The required conventions are:

  • The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.
  • The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.
  • The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.

Because these requirements are largely expressed as conventions rather than by implementing interfaces, some developers view JavaBeans as Plain Old Java Objects that follow specific naming conventions.

POJO

A Plain Old Java Object or POJO is a term initially introduced to designate a simple lightweight Java object, not implementing any javax.ejb interface, as opposed to heavyweight EJB 2.x (especially Entity Beans, Stateless Session Beans are not that bad IMO). Today, the term is used for any simple object with no extra stuff. Again, Wikipedia does a good job at defining POJO:

POJO is an acronym for Plain Old Java Object. The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean (especially before EJB 3). The term was coined by Martin Fowler, Rebecca Parsons and Josh MacKenzie in September 2000:

"We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely."

The term continues the pattern of older terms for technologies that do not use fancy new features, such as POTS (Plain Old Telephone Service) in telephony, and PODS (Plain Old Data Structures) that are defined in C++ but use only C language features, and POD (Plain Old Documentation) in Perl.

The term has most likely gained widespread acceptance because of the need for a common and easily understood term that contrasts with complicated object frameworks. A JavaBean is a POJO that is serializable, has a no-argument constructor, and allows access to properties using getter and setter methods. An Enterprise JavaBean is not a single class but an entire component model (again, EJB 3 reduces the complexity of Enterprise JavaBeans).

As designs using POJOs have become more commonly-used, systems have arisen that give POJOs some of the functionality used in frameworks and more choice about which areas of functionality are actually needed. Hibernate and Spring are examples.

Value Object

A Value Object or VO is an object such as java.lang.Integer that hold values (hence value objects). For a more formal definition, I often refer to Martin Fowler's description of Value Object:

In Patterns of Enterprise Application Architecture I described Value Object as a small object such as a Money or date range object. Their key property is that they follow value semantics rather than reference semantics.

You can usually tell them because their notion of equality isn't based on identity, instead two value objects are equal if all their fields are equal. Although all fields are equal, you don't need to compare all fields if a subset is unique - for example currency codes for currency objects are enough to test equality.

A general heuristic is that value objects should be entirely immutable. If you want to change a value object you should replace the object with a new one and not be allowed to update the values of the value object itself - updatable value objects lead to aliasing problems.

Early J2EE literature used the term value object to describe a different notion, what I call a Data Transfer Object. They have since changed their usage and use the term Transfer Object instead.

You can find some more good material on value objects on the wiki and by Dirk Riehle.

Data Transfer Object

Data Transfer Object or DTO is a (anti) pattern introduced with EJB. Instead of performing many remote calls on EJBs, the idea was to encapsulate data in a value object that could be transfered over the network: a Data Transfer Object. Wikipedia has a decent definition of Data Transfer Object:

Data transfer object (DTO), formerly known as value objects or VO, is a design pattern used to transfer data between software application subsystems. DTOs are often used in conjunction with data access objects to retrieve data from a database.

The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behaviour except for storage and retrieval of its own data (accessors and mutators).

In a traditional EJB architecture, DTOs serve dual purposes: first, they work around the problem that entity beans are not serializable; second, they implicitly define an assembly phase where all data to be used by the view is fetched and marshalled into the DTOs before returning control to the presentation tier.


So, for many people, DTOs and VOs are the same thing (but Fowler uses VOs to mean something else as we saw). Most of time, they follow the JavaBeans conventions and are thus JavaBeans too. And all are POJOs.

Answer from Pascal Thivent on Stack Overflow
Top answer
1 of 10
957

JavaBeans

A JavaBean is a class that follows the JavaBeans conventions as defined by Sun. Wikipedia has a pretty good summary of what JavaBeans are:

JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a Java Object that is serializable, has a nullary constructor, and allows access to properties using getter and setter methods.

In order to function as a JavaBean class, an object class must obey certain conventions about method naming, construction, and behavior. These conventions make it possible to have tools that can use, reuse, replace, and connect JavaBeans.

The required conventions are:

  • The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.
  • The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.
  • The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.

Because these requirements are largely expressed as conventions rather than by implementing interfaces, some developers view JavaBeans as Plain Old Java Objects that follow specific naming conventions.

POJO

A Plain Old Java Object or POJO is a term initially introduced to designate a simple lightweight Java object, not implementing any javax.ejb interface, as opposed to heavyweight EJB 2.x (especially Entity Beans, Stateless Session Beans are not that bad IMO). Today, the term is used for any simple object with no extra stuff. Again, Wikipedia does a good job at defining POJO:

POJO is an acronym for Plain Old Java Object. The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean (especially before EJB 3). The term was coined by Martin Fowler, Rebecca Parsons and Josh MacKenzie in September 2000:

"We wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely."

The term continues the pattern of older terms for technologies that do not use fancy new features, such as POTS (Plain Old Telephone Service) in telephony, and PODS (Plain Old Data Structures) that are defined in C++ but use only C language features, and POD (Plain Old Documentation) in Perl.

The term has most likely gained widespread acceptance because of the need for a common and easily understood term that contrasts with complicated object frameworks. A JavaBean is a POJO that is serializable, has a no-argument constructor, and allows access to properties using getter and setter methods. An Enterprise JavaBean is not a single class but an entire component model (again, EJB 3 reduces the complexity of Enterprise JavaBeans).

As designs using POJOs have become more commonly-used, systems have arisen that give POJOs some of the functionality used in frameworks and more choice about which areas of functionality are actually needed. Hibernate and Spring are examples.

Value Object

A Value Object or VO is an object such as java.lang.Integer that hold values (hence value objects). For a more formal definition, I often refer to Martin Fowler's description of Value Object:

In Patterns of Enterprise Application Architecture I described Value Object as a small object such as a Money or date range object. Their key property is that they follow value semantics rather than reference semantics.

You can usually tell them because their notion of equality isn't based on identity, instead two value objects are equal if all their fields are equal. Although all fields are equal, you don't need to compare all fields if a subset is unique - for example currency codes for currency objects are enough to test equality.

A general heuristic is that value objects should be entirely immutable. If you want to change a value object you should replace the object with a new one and not be allowed to update the values of the value object itself - updatable value objects lead to aliasing problems.

Early J2EE literature used the term value object to describe a different notion, what I call a Data Transfer Object. They have since changed their usage and use the term Transfer Object instead.

You can find some more good material on value objects on the wiki and by Dirk Riehle.

Data Transfer Object

Data Transfer Object or DTO is a (anti) pattern introduced with EJB. Instead of performing many remote calls on EJBs, the idea was to encapsulate data in a value object that could be transfered over the network: a Data Transfer Object. Wikipedia has a decent definition of Data Transfer Object:

Data transfer object (DTO), formerly known as value objects or VO, is a design pattern used to transfer data between software application subsystems. DTOs are often used in conjunction with data access objects to retrieve data from a database.

The difference between data transfer objects and business objects or data access objects is that a DTO does not have any behaviour except for storage and retrieval of its own data (accessors and mutators).

In a traditional EJB architecture, DTOs serve dual purposes: first, they work around the problem that entity beans are not serializable; second, they implicitly define an assembly phase where all data to be used by the view is fetched and marshalled into the DTOs before returning control to the presentation tier.


So, for many people, DTOs and VOs are the same thing (but Fowler uses VOs to mean something else as we saw). Most of time, they follow the JavaBeans conventions and are thus JavaBeans too. And all are POJOs.

2 of 10
88

DTO vs VO

DTO - Data Transfer Object is just a data container which is used to transport data between layers and tiers.

  • It mainly contains attributes. You can even use public attributes without getters and setters.
  • Data Transfer Objects do not contain any business logic.

Analogy:
Simple registration form with attributes username, password and email ID.

  • When this form is submitted in RegistrationServlet file you will get all the attributes from view layer to business layer where you pass the attributes to java beans and then to the DAO or the persistence layer.
  • DTO helps in transporting the attributes from view layer to business layer and finally to the persistence layer.

DTO was mainly used to get data transported across the network efficiently, it may be even from JVM to another JVM.

DTOs are often java.io.Serializable - in order to transfer data across JVM.

VO - Value Object [1][2] represents a fixed set of data and is similar to a Java enum. A Value Object's identity is based on their state rather than on their object identity and is immutable. A real world example would be Color.RED, Color.BLUE, SEX.FEMALE etc.


POJO vs JavaBeans

[1] The "Java-Beanness" of a POJO is that its private attributes are all accessed via public getters and setters that conform to the JavaBeans conventions. e.g.

private String foo;
public String getFoo() {...}
public void setFoo(String foo) {...}; 

[2] JavaBeans must implement Serializable and have a no-argument constructor, whereas in POJO does not have these restrictions.

🌐
Coderanch
coderanch.com › t › 497469 › java › difference-DTO-Bean
What is the difference between DTO and Bean? (Java in General forum at Coderanch)
October 12, 2016 - ... And we may know what exactly ... some context the java beans names decided by the context used, like in EJB, the POJO name comes for the beans and for transferring the data, the DTO name comes....
Discussions

Differences between Java bean, entity class, DAO, POJO, EJB and DTO?
Java Bean a Serializable Class with No arguments constructor and getter/setters for each field. More https://en.wikipedia.org/wiki/Java_bean POJO - Plain Old Java Object is like Java Bean however it is not required to be serializable and it is not required to have a no arguments constructor. More https://en.wikipedia.org/wiki/Plain_old_Java_object DTO - Data Transfer Object it is basically POJO that is used to transfer data between several layers. It is not different from the above the only difference is how it is used. Usually it transfers data from the database into our application, e.g. you have a table users and you have a DTO UserDTO that you fill with that Data and then play around. More https://en.wikipedia.org/wiki/Data_transfer_object Model class is nothing it is just a different naming convention for DTOs they also hold Data but usually they are used on the frontend side and not so close to the Database side. Also you may hit a VOs at some point simply called ValueObjects they are basically DTOs or Models that goes between and around layers of you amazing Lasagne like architecture :) More info https://en.wikipedia.org/wiki/Lasagne yup it s a food did you click it ? :) P.S. a normal architecture (a bit overdesigned maybe is like that(read from the bottom!)) -Views using Models and Forms which are the same. -Controllers using this DTOs to fill their Models or the Views .. -Facade used to abstract the service layer and to convert this Entities to something cachable and small like DTOs -Service layer with some crazy logic and do magic and transactions and stuff -DAO to access the Database basically generating Entity Objects (from a JPA or some ORM) -Database Regards, More on reddit.com
🌐 r/learnjava
6
20
March 18, 2019
java - What is the difference between a JavaBean and a POJO? - Stack Overflow
I'm not sure about the difference. I'm using Hibernate and, in some books, they use JavaBean and POJO as an interchangeable term. I want to know if there is a difference, not just in the Hibernate More on stackoverflow.com
🌐 stackoverflow.com
java - What is the point of using DTO (Data Transfer Objects)? - Software Engineering Stack Exchange
Having a separate view model that ... from the DTOs almost never makes sense. However, the reason why this notion is outdated rather than just plain wrong is that some (mainly older) frameworks/technologies require it, as their domain and view models are not POJOS and instead tied directly to the framework. Most notably, Entity Beans in J2EE prior ... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
October 26, 2012
¿Diferencias entre Java bean, clase entidad, DAO, POJO, EJB y DTO?
Java Bean: Una clase serializable con un constructor sin argumentos y métodos getter/setters para cada campo. Más https://en.wikipedia.org/wiki/Java_bean POJO: Objeto Plano de Java (Plain Old Java Object) es como Java Bean, sin embargo, no es necesario que sea serializable y no necesita tener un constructor sin argumentos. Más https://en.wikipedia.org/wiki/Plain_old_Java_object DTO: Objeto de Transferencia de Datos (Data Transfer Object), básicamente un POJO que se usa para transferir datos entre varias capas. No es diferente de los anteriores, la única diferencia es cómo se usa. Normalmente transfiere datos de la base de datos a nuestra aplicación, por ejemplo, tienes una tabla de usuarios y tienes un DTO UserDTO que llenas con esos datos y luego manipulas. Más https://en.wikipedia.org/wiki/Data_transfer_object Model: La clase no es nada, es solo una convención de nomenclatura diferente para DTOs, también contienen datos, pero generalmente se usan en el lado del frontend y no tan cerca del lado de la base de datos. También puedes encontrarte con VOs en algún momento, simplemente llamados ValueObjects, que son básicamente DTOs o Models que van entre y alrededor de las capas de tu increíble arquitectura tipo lasaña :) Más información https://en.wikipedia.org/wiki/Lasagne sí, es comida, ¿hiciste clic? :) P.S. una arquitectura normal (un poco sobrediseñada quizás es así (¡léelo desde abajo!)) -Vistas usando Models y Formularios que son iguales. -Controladores usando estos DTOs para llenar sus Models o las Vistas... -Fachada usada para abstraer la capa de servicio y convertir estas Entidades en algo almacenable en caché y pequeño como DTOs -Capa de servicio con algo de lógica loca y haciendo magia y transacciones y cosas así -DAO para acceder a la base de datos, básicamente generando Objetos Entidad (de un JPA o algún ORM) -Base de datos Saludos, More on reddit.com
🌐 r/learnjava
6
20
March 18, 2019
🌐
Baeldung
baeldung.com › home › java › difference between pojo, javabeans, dto and vo
Difference Between POJO, JavaBeans, DTO and VO | Baeldung
January 16, 2024 - Here, in order to convert the POJO into a JavaBean, we’ve implemented the Serializable interface, marked properties as private, and used getter/setter methods to access the properties. A DTO, also referred to as Data Transfer Object, encapsulates values to carry data between processes or networks.
🌐
Reddit
reddit.com › r/learnjava › differences between java bean, entity class, dao, pojo, ejb and dto?
r/learnjava on Reddit: Differences between Java bean, entity class, DAO, POJO, EJB and DTO?
March 18, 2019 -

I am learning Java EE and spring but I got confused with these terms From my understanding, DAO should contain all database access logic (sql and ORM code should place here) . But what's use of DTO? EJB ,POJO and model class are identical?

Top answer
1 of 4
10
Java Bean a Serializable Class with No arguments constructor and getter/setters for each field. More https://en.wikipedia.org/wiki/Java_bean POJO - Plain Old Java Object is like Java Bean however it is not required to be serializable and it is not required to have a no arguments constructor. More https://en.wikipedia.org/wiki/Plain_old_Java_object DTO - Data Transfer Object it is basically POJO that is used to transfer data between several layers. It is not different from the above the only difference is how it is used. Usually it transfers data from the database into our application, e.g. you have a table users and you have a DTO UserDTO that you fill with that Data and then play around. More https://en.wikipedia.org/wiki/Data_transfer_object Model class is nothing it is just a different naming convention for DTOs they also hold Data but usually they are used on the frontend side and not so close to the Database side. Also you may hit a VOs at some point simply called ValueObjects they are basically DTOs or Models that goes between and around layers of you amazing Lasagne like architecture :) More info https://en.wikipedia.org/wiki/Lasagne yup it s a food did you click it ? :) P.S. a normal architecture (a bit overdesigned maybe is like that(read from the bottom!)) -Views using Models and Forms which are the same. -Controllers using this DTOs to fill their Models or the Views .. -Facade used to abstract the service layer and to convert this Entities to something cachable and small like DTOs -Service layer with some crazy logic and do magic and transactions and stuff -DAO to access the Database basically generating Entity Objects (from a JPA or some ORM) -Database Regards,
2 of 4
6
JavaBeans were classes that had a no-args constructor, getter-setters, and were serializable. Originally they were useful ways to package a lot of stateful information to send between JVMs, and became standard for the EJB, JavaEE's base component for its application servers which managed their lifecycles and transactions for us. POJO was a reference to a Java class that didn't try to match these requirements. An entity is an object representation of data pulled from your DAO. It may or may not align exactly with your model, in which case a DTO could help translate from Entity to Model (or Model to serialized data for export).
🌐
YouTube
youtube.com › techtalk debu
Differences - POJO vs Bean vs Entity vs DTO/VO vs Model vs Domain Class | Java Tutorial - YouTube
Differences among POJO vs Bean vs DTO/VO vs Model vs Domain Class | Deep Drive into practical knowledge : if you like my video, please subscribe to my channe...
Published   September 11, 2019
Views   3K
🌐
Medium
medium.com › incluit › pojo-javabean-dto-and-records-ebd63de23591
Pojo, JavaBean, DTO and Records. This document is an attempt to reveal… | by Sebastian Torralba | AvengaLATAM | Medium
June 5, 2023 - DTO is a Pattern introduced by (All raise, please) Martin Flowler, we can implement it using POJO or Records if we are using the latest version of JDK, which means it is a simple Java object that encapsulates data and has no behavior.
🌐
Edureka Community
edureka.co › home › community › categories › java › dto vs vo vs pojo vs javabeans
DTO vs VO vs POJO vs JavaBeans | Edureka Community
August 14, 2018 - 14744/dto-vs-vo-vs-pojo-vs-javabeans · Home · Community · Categories · Java · DTO vs VO vs POJO vs JavaBeans · how do I turn a double in an array from 1000 to infinity Jul 9, 2024 · I have created a code in java for a flower shop and now my IDE is showing all the inputs are in red showing there is an error Jul 6, 2024 ·
Find elsewhere
🌐
Quora
quora.com › What-is-the-difference-between-POJO-and-DTO
What is the difference between POJO and DTO? - Quora
A JavaBean is a POJO that is serializable, has a no-argument constructor, and allows access to properties using getter and setter methods. ... Data transfer object (DTO), formerly known as value objects or VO, is a design pattern used to transfer ...
🌐
Medium
kathir-i.medium.com › difference-between-javabeans-vo-pojo-and-dto-e0abc42615f0
Difference between JavaBeans, VO, POJO and DTO | by Sri Kathiravan | Medium
September 4, 2021 - Difference between JavaBeans, VO, POJO and DTO JavaBeans JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written …
🌐
springjava
springjava.com › spring-boot › pojo-vs-bean-vs-dto-in-spring-boot
POJO vs Bean vs DTO in Spring Boot
June 23, 2025 - POJO = A basic Java object with fields, constructors, and methods—framework-agnostic. Bean = A Spring-managed object that participates in the Spring container and dependency injection.
🌐
codippa
codippa.com › home › pojo vs javabeans vs dto vs vo
POJO vs JavaBeans vs DTO vs VO - codippa
January 13, 2025 - Example of a java bean is · public ... Student() {} // getter and setter methods } [the_ad id=”656″] DTO DTO stands for “Data Transfer Object”. It is a POJO that is used to transfer data between layers or systems such ...
🌐
Lingi04
lingi04.github.io › backend › springboot › pojo-javabeans-vo-dto.html
POJO vs JAVA BEANS vs VO vs DTO | Lingi04
September 21, 2019 - In a traditional EJB architecture, ... JavaBeans의 컨벤션을 따르므로 JavaBeans라고생각해도 됨. 그리고 JavaBeans는 POJO 이므로 VO와 DTO를 POJO라고 생각하면 된다....
🌐
W3Docs
w3docs.com › java
Difference between DTO, VO, POJO, JavaBeans?
DTOs are typically used to transfer data between processes, VOs are used to represent data in the presentation layer, POJOs are simple data containers, and JavaBeans follow certain conventions for naming and accessing properties.
🌐
Bayt
specialties.bayt.com › en › specialties › q › 6927 › difference-between-dto-vo-pojo-javabeans
Difference between DTO, VO, POJO, JavaBeans?
June 11, 2013 - Apply now to over 4280 J2ee jobs in Middle East and Gulf and make your job hunting simpler. Find the latest J2ee job vacancies and employment opportunities in Middle East and Gulf.
🌐
Medium
sumitmm.medium.com › if-youre-confused-by-pojo-bean-dto-entity-and-the-rest-read-this-5df4da2cd9d2
If You’re Confused by POJO, Bean, DTO, Entity, and the Rest — Read This | by SumitM | Jun, 2025 | Medium
June 29, 2025 - A POJO that is managed by the Spring framework. Must follow JavaBean rules (no-arg constructor + getters/setters). Spring creates it when annotated with @Component, @Service, @Repository, etc. @Component public class MyBean { // Spring manages this } 📌 All Beans are POJOs, but not all POJOs are Beans.
Top answer
1 of 6
156

DTO is a pattern and it is implementation (POJO/POCO) independent. DTO says, since each call to any remote interface is expensive, response to each call should bring as much data as possible. So, if multiple requests are required to bring data for a particular task, data to be brought can be combined in a DTO so that only one request can bring all the required data. Catalog of Patterns of Enterprise Application Architecture has more details.

DTO's are a fundamental concept, not outdated.

2 of 6
74

DTO as a concept (objects whose purpose is to collect data to be returned to the client by the server) is certainly not outdated.

What is somewhat outdated is the notion of having DTOs that contain no logic at all, are used only for transmitting data and "mapped" from domain objects before transmission to the client, and there mapped to view models before passing them to the display layer. In simple applications, the domain objects can often be directly reused as DTOs and passed through directly to the display layer, so that there is only one unified data model. For more complex applications you don't want to expose the entire domain model to the client, so a mapping from domain models to DTOs is necessary. Having a separate view model that duplicates the data from the DTOs almost never makes sense.

However, the reason why this notion is outdated rather than just plain wrong is that some (mainly older) frameworks/technologies require it, as their domain and view models are not POJOS and instead tied directly to the framework.

Most notably, Entity Beans in J2EE prior to the EJB 3 standard were not POJOs and instead were proxy objects constructed by the app server - it was simply not possible to send them to the client, so you had no choice about haing a separate DTO layer - it was mandatory.

🌐
HackMD
hackmd.io › @MonsterLee › HJyAdgRBB
一次搞懂POJO、PO、DTO、VO、BO - HackMD
This term was coined by Martin Fowler, Rebbecca Parsons and Josh MacKenzie who believed that by creating the acronym POJO, such objects would have a "fancy name", thereby convincing people that they were worthy of use. ### PO (persistent object) #### 定義 因為ORM框架的誕生所以才有PO的概念,可以簡單地將它視為資料庫table對應的java物件,通常PO的名詞都會與使用hibernate相關 ### DTO (Data Transfer Object) #### 定義 傳輸用的物件,假設今天我的程式像資料庫提取了PO資料物件,我必須將我的資料傳往其他系統或是服務時