Pojo

Plain Old Java Object

is a Java object not bound by any restriction other than those forced by the Java Language Specification. I.e., a POJO should not have to

Extend prespecified classes

Implement prespecified interface

Contain prespecified annotations

Basically a class with attributes and it's getters and setters.

Answer from Ankur Singhal on Stack Overflow
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pojo class in java
POJO Class in Java: A Comprehensive Tutorial | upGrad
April 2, 2025 - A Plain Old Java Object or POJO represents basic Java classes that lack both extended and implemented features in specific Java constructs and serve to organize data for clear reuse.
Discussions

Can pojo classes have some logic inside?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/javahelp
12
4
October 26, 2021
Not null fields in a POJO class.
I think you can use @notnull from javax.peristance and validate the class before saving it to db More on reddit.com
๐ŸŒ r/learnjava
19
1
July 17, 2021
Having the same POJO in multiple microservices
Keep the business logic in a separate (maven) module? More on reddit.com
๐ŸŒ r/javahelp
3
2
April 12, 2017
How to convert json string to pojo if json response starts with [] instead of {} ??
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full - best also formatted as code block You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/learnjava
12
1
August 21, 2023
People also ask

How do POJO classes work with Hibernate?
In Hibernate, POJO (Plain Old Java Object) classes represent database entities, and Hibernate uses these classes to map database tables to Java objects, allowing for object-relational mapping (ORM). You can think of POJOs as the building blocks for your data model, and Hibernate handles the persistence and retrieval of these objects to and from the database.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pojo class in java
POJO Class in Java: A Comprehensive Tutorial | upGrad
Is a POJO always serializable?
All JavaBeans are POJOs but not all POJOs are JavaBeans. Serializable, i.e. they should implement the Serializable interface. Still, some POJOs that don't implement a Serializable interface are called POJOs because Serializable is a marker interface and therefore not of many burdens.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pojo class in java
POJO Class in Java: A Comprehensive Tutorial | upGrad
How is POJO used in Spring Boot?
In Spring Boot, POJOs (Plain Old Java Objects) are commonly used to represent data models, request/response bodies, and configuration properties. Spring Boot leverages POJOs for various purposes, primarily for creating Java objects that are easy to manage and work with within the Spring context.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pojo class in java
POJO Class in Java: A Comprehensive Tutorial | upGrad
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ pojo class in java
POJO Class in Java - Scaler Topics
April 5, 2024 - POJO, short for Plain Old Java Object, is a standard Java object with minimal restrictions imposed by the Java Language Specification. It operates without requiring any specific classpath.
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ core java โ€บ what is a pojo class?
What Is a Pojo Class? | Baeldung
June 11, 2024 - Weโ€™ll look at how a POJO compares to a JavaBean, and how turning our POJOs into JavaBeans can be helpful. When we talk about a POJO, what weโ€™re describing is a straightforward type with no references to any particular frameworks. A POJO has no naming convention for our properties and methods. Letโ€™s create a basic employee POJO. Itโ€™ll have three properties; first name, last name, and start date: public class EmployeePojo { public String firstName; public String lastName; private LocalDate startDate; public EmployeePojo(String firstName, String lastName, LocalDate startDate) { this.firstName = firstName; this.lastName = lastName; this.startDate = startDate; } public String name() { return this.firstName + " " + this.lastName; } public LocalDate getStart() { return this.startDate; } }
๐ŸŒ
Smartprogramming
smartprogramming.in โ€บ tutorials โ€บ spring-framework โ€บ pojo-classes-and-java-bean-classes
Java Beans & POJO Classes
POJO classes are mainly used for data representation and data transfer. ... Encapsulation : JavaBeans allow data encapsulation with strict conventions, providing standardized access and modification through getters and setters. Data Transfer : JavaBeans are frequently used as Data Transfer ...
๐ŸŒ
Medium
medium.com โ€บ @Bharat2044 โ€บ what-is-pojo-class-in-java-1325eb7f3a6c
What is POJO Class in Java ?. POJO stands for Plain Old Java Objectโ€ฆ | by Bharat | Medium
February 15, 2024 - It is a term used to describe a Java class that follows simple conventions and does not depend on any specific frameworks or libraries. A POJO typically contains private fields with corresponding getter and setter methods, and it may also include ...
Find elsewhere
๐ŸŒ
TechVidvan
techvidvan.com โ€บ tutorials โ€บ java-pojo-class
Java POJO class - Plain Old Java Object - TechVidvan
June 8, 2020 - They are only bound with some restrictions on Java Language Specifications. Simply, POJO acts as a pure data structure that has getter and setter methods. POJO objects do not require any classpath. POJO is the most widely used class in Java because it is very easy to write and understand.
๐ŸŒ
Coderanch
coderanch.com โ€บ t โ€บ 668887 โ€บ java โ€บ Understanding-POJO-Java
Understanding POJO in Java (Java in General forum at Coderanch)
August 4, 2016 - ... A plain old Java object (POJO) is an ordinary Java object, not bound by any special restriction https://en.wikipedia.org/wiki/Plain_Old_Java_Object a POJO should not have to extend or implement prespecified classes or contain prespecified annotations Below is a simple POJO class A JavaBean ...
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Plain_old_Java_object
Plain old Java object - Wikipedia
October 21, 2025 - The idea is that if the object (actually class) were a POJO before any annotations were added, and would return to POJO status if the annotations are removed then it can still be considered a POJO. Then the basic object remains a POJO in that it has no special characteristics (such as an implemented interface) that makes it a "Specialized Java Object" (SJO or (sic) SoJO).
๐ŸŒ
Reddit
reddit.com โ€บ r/javahelp โ€บ can pojo classes have some logic inside?
r/javahelp on Reddit: Can pojo classes have some logic inside?
October 26, 2021 -

I am trying to build a text adventure in java. I have something running already, but now I realized that I want to store some configuration in json/yaml (I did not decided yet). Then I'll use something like Jackson for deserializing. Now, as far as I know, POJO classes must have only variables, empty constructor, getters and setters. But I have some classes that I'd like to use for deserializing that contains other methods, for example the Player class has methods for moving, attacking and so on. Does this creates errors with JSON parsing? Is this a bad practice in some way?

Side question, I always thought that POJO classes kinda "violates" encapsulation principle, because from my understanding encapsulation states that an object contains data and behavior. Am I missing something?

๐ŸŒ
Medium
medium.com โ€บ @mukul.sharma8896 โ€บ pojo-classes-in-java-and-marshellling-unmarshelling-jackson-gson-jaxb-810d14f59fe3
POJO classes in java and Marshellling & Unmarshelling (Jackson/GSON/JAXB). | by Mukul Kumar | Medium
March 25, 2023 - POJO stands for Plain Old Java Object. It is a simple Java object that does not inherit from any specific class or implement any specific interface.
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ java โ€บ pojo
Java | POJO | Codecademy
April 9, 2025 - A POJO (Plain Old Java Object) is a class not tied to any Java framework, allowing any Java program to create simple, framework-independent objects for data representation.
๐ŸŒ
DataFlair
data-flair.training โ€บ blogs โ€บ pojo-class-in-java
POJO Class in Java (Plain Old Java Object with Example) - DataFlair
September 14, 2018 - POJO stands for Plain Old Java Object. A normal Java object, not sure by any special restriction. But when forced by the Java Language Specification and not requiring any classpath.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ advance java โ€บ pojo-vs-java-beans
POJO vs Java Beans - GeeksforGeeks
October 27, 2025 - A POJO (Plain Old Java Object) is a simple Java object that is not bound by any special restriction other than those enforced by the Java Language Specification. It does not require any specific framework or classpath dependency.
๐ŸŒ
Quora
quora.com โ€บ What-is-POJO-in-Java
What is POJO in Java? - Quora
Answer (1 of 7): POJO stands for โ€œPlain Old Java Objectโ€ โ€” itโ€™s a pure data structure that has fields with getters and possibly setters, and may override some methods from Object (e.g. equals) or some other interface like Serializable, ...
๐ŸŒ
Edureka
edureka.co โ€บ blog โ€บ pojo-in-java
POJO In Java | POJO vs Java Beans | Java Programming | Edureka
June 17, 2021 - This article will help you explore the subject in detail, ... In simpler terms, Pojo is defined as a pure data structure, containing the getter and setter fields. It has the ability to override certain methods from Object or an interface such ...
๐ŸŒ
GroTechMinds
grotechminds.com โ€บ home โ€บ creating and using pojo classes in restassured for api testing
Creating and Using POJO Classes in RestAssured for API Testing
February 27, 2025 - Now we can deserialize the deserialization of POJO and convert a JSON or XML response into a Java object (POJO) for easy manipulation of the code. We need to follow below steps: In this, we want to read the value we need to enter JSON String and enter the class name with .class extension whose value we want to read.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ hibernate-create-pojo-classes
Hibernate - Create POJO Classes - GeeksforGeeks
July 23, 2025 - POJO does not have any name convention for properties and methods. It's just a java class consisting of some variables and getters-setters. POJO classes are used in hibernate for mapping to database objects.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ java-java-pojo-class-117946
Mastering Java POJOs: Unleash the Power of Plain Old Java Objects | LabEx
In this lab, you learned about POJOs and their role in Java programming. You learned how to create a POJO class and the difference between a POJO and a Java Bean class. You learned how to convert a POJO class to a Java Bean class and how to use Reflection API to view the properties of a Java Bean class.
๐ŸŒ
Ayshwarya.katheria
ayshkatheria.hashnode.dev โ€บ understanding-the-difference-between-pojo-and-record-classes-in-java
Understanding the Difference between POJO and Record Classes in Java
July 22, 2023 - Record classes were introduced in Java 14 and are available in later versions. ... Both POJO and Record classes are valuable tools for representing data in Java. POJOs provide flexibility for adding additional behavior to the classes, while Record classes offer a concise and elegant way to define immutable data-holding classes with minimal boilerplate code.