Questions tagged [pojo]

POJO is an acronym for Plain Old Java Object. The name is used to emphasize that a given object is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean.

POJO (Plain Old Java Object) is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks such as EJB.

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, PODS (Plain Old Data Structures) that are defined in C++ but use only C language features, and POD (Plain Old Documentation) in Perl. The equivalent to POJO on the .NET framework is Plain Old CLR Object (POCO). For PHP, it is Plain Old PHP Object (POPO).

1840 questions
677
votes
8 answers

Difference between DTO, VO, POJO, JavaBeans?

Have seen some similar questions: What is the difference between a JavaBean and a POJO? What is the Difference Between POJO (Plain Old Java Object) and DTO (Data Transfer Object)? Can you also please tell me the contexts in which they are used? Or…
jai
  • 21,519
  • 31
  • 89
  • 120
302
votes
9 answers

Convert a Map to a POJO

I've been looking at Jackson, but is seems I would have to convert the Map to JSON, and then the resulting JSON to the POJO. Is there a way to convert a Map directly to a POJO?
user86834
  • 5,357
  • 10
  • 34
  • 47
232
votes
10 answers

What is the difference between a JavaBean and a POJO?

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 context, but as general concepts.
DJphilomath
  • 2,550
  • 2
  • 15
  • 11
200
votes
10 answers

Date format Mapping to JSON Jackson

I have a Date format coming from API like this: "start_time": "2015-10-1 3:00 PM GMT+1:00" Which is YYYY-DD-MM HH:MM am/pm GMT timestamp. I am mapping this value to a Date variable in POJO. Obviously, its showing conversion error. I would like to…
Kevin Rave
  • 13,876
  • 35
  • 109
  • 173
183
votes
11 answers

What is the difference between field, variable, attribute, and property in Java POJOs?

When referring to internal private variables of Java POJOs that have getters/setters, I've used the following terms: field variable attribute property Is there any difference between the above? If so, what is the correct term to use? Is there a…
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
147
votes
9 answers

Spring Data JPA map the native query result to Non-Entity POJO

I have a Spring Data repository method with a native query @Query(value = "SELECT g.*, gm.* FROM group g LEFT JOIN group_members gm ON g.group_id = gm.group_id and gm.user_id = :userId WHERE g.group_id = :groupId", nativeQuery = true) GroupDetails…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
113
votes
3 answers

What is java pojo class, java bean, normal class?

Possible Duplicate: Difference between DTO, VO, POJO, JavaBeans? Hi please don't say my question is duplicate :-) I saw all questions but didn't understand the exact difference. Can someone explain what is POJO, Bean, Normal Class in easy…
Siva
  • 3,297
  • 7
  • 29
  • 35
87
votes
3 answers

IntelliJ IDEA 10 generate entity (POJO) from DB model

How can I generate entity (POJO) from database model using IntelliJ IDEA 10. I create "Data source" in IntelliJ but I have not any idea how can I generate the POJO.
pierre
  • 871
  • 1
  • 8
  • 6
80
votes
7 answers

Why shouldn't I use immutable POJOs instead of JavaBeans?

I have implemented a few Java applications now, only desktop applications so far. I prefer to use immutable objects for passing the data around in the application instead of using objects with mutators (setters and getters), also called…
Jonas
  • 121,568
  • 97
  • 310
  • 388
74
votes
9 answers

What is meaning of Plain Old Java Object (POJO)?

What does the term Plain Old Java Object (POJO) mean? I couldn't find anything explanatory enough. POJO's Wikipedia page says that POJO is an ordinary Java Object and not a special object. Now, what makes or what doesn't make and object special in…
Nikit Batale
  • 1,790
  • 2
  • 15
  • 20
70
votes
6 answers

How to convert POJO to JSON and vice versa?

I want to know if there is any Java API available to convert a POJO object to a JSON object and vice versa.
Mariah
  • 1,073
  • 1
  • 14
  • 33
70
votes
11 answers

How to create a POJO?

Recently I've started hearing about "POJOs" (Plain Old Java Objects). I googled it, but still don't understand the concept well. Can anyone give me a clear description of a POJO? Consider a class "Person" with variables "id, name, address, salary"…
user405398
57
votes
4 answers

JSON Post request for boolean field sends false by default

Hi I am sending a JSON Post request using the FireFox RestClient. My JSON Request is as below: { "firstName": "Test", "lastName": "1", "isActive": 1 } My POJO has isActive field as below private boolean isActive; My Controller is define as…
NewQueries
  • 4,841
  • 11
  • 33
  • 39
50
votes
1 answer

Jackson: is there a way to serialize POJOs directly to treemodel?

I'm looking for a way to directly convert some POJO to a Jackson TreeModel. I know that a translation from POJO-to-JSON-String exists, and TreeModel-to-JSON-String is supported — hovewer I am looking for a POJO-to-TreeModel translation. Is there a…
Geert-Jan
  • 18,623
  • 16
  • 75
  • 137
50
votes
2 answers

How to define a map in a YAML file for simple POJO?

I am using SnakeYAML to parse certain configuration/property values to a Configuration object (defined below). My YAML file looks like this: # Thread batchLimit: 1000 threadCountLimit: 2 # Some more config key: value # Map keyMapping:
frugalcoder
  • 959
  • 2
  • 11
  • 23
1
2 3
99 100