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
11
votes
2 answers

Grails: Can I use domain objects when I don't want to save anything?

Some of my domain classes are getting rather rich: They implement an interesting comparable, might have plus, minus, multiply and div, many have some convenient getters which call services and determine complicated things. And most of all, they…
Mikey
  • 4,692
  • 10
  • 45
  • 73
10
votes
2 answers

Deserialize flat array in XML by Jackson to List of Pojo

Can you help me to parse the following XML file? 2017-10-25T09:13:54+02:00 1 Stuart 34
Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
10
votes
2 answers

Conditional field requirement based on another field value in Jackson?

Consider a JSON representation with one string and two arrays. For example, { "type" : "A", "ListA" : [] "ListB" : [3, 4, 5] } In the above case, type is required field, but ListA and ListB are conditionally required for…
THIS USER NEEDS HELP
  • 3,136
  • 4
  • 30
  • 55
10
votes
4 answers

POJO vs EJB vs EJB 3

Does anyone have any example of what a Java Class might look like as a POJO, EJB, and EJB 3? I'm trying to understand these java technologies but am having trouble. I was hoping it would help if I could see what an implementation of all three would…
hello_world_infinity
  • 4,760
  • 9
  • 32
  • 32
9
votes
1 answer

GraphQL Java Class Generator

I want to dive into graphQL using Java. I want to query an existing graphQL Service. From what I have found so far are ways to generate the graphQL schemafiles either in JSON or IDL from your POJO classes, but not the other way round....? From what…
Yves030
  • 181
  • 2
  • 3
  • 6
9
votes
1 answer

Converting a POJO to Form Data in Java

I have a POJO of the form: @Data public class BaseRequest { private String type; private Map details; private Map signature; } I have a service running which only accepts Content Type:…
Qawls
  • 91
  • 1
  • 4
9
votes
3 answers

Firebase "Map while deserializing, but got a class java.util.ArrayList"

I am just trying out Firebase on android for my project. the problem I got is that every time I take a snapshot and "cast" it back to POJO I get this - "Map while deserializing, but got a class java.util.ArrayList" Exception. I've been looking…
Aufa Husen
  • 133
  • 1
  • 8
9
votes
4 answers

Plain Old Objects in Ruby?

I notice in Ruby it is very common to for vendor APIs to pass back results as arrays? Shouldn't Plain Old Objects (Like POJOs in Java) be more of a standard? If I write my own library shouldn't I use POJOs POROs?
Zombies
  • 25,039
  • 43
  • 140
  • 225
9
votes
4 answers

Pojo to xsd generation

Is there a library which could generate a xsd schema from a java class? Google yields lots of results the opposite ( java classes from xsd ).
Surya
  • 4,922
  • 8
  • 41
  • 54
9
votes
6 answers

How to convert json into POJO in java using jackson

I'm using spring 3.1.2 and I need to parse a json object into POJO. This is the json that I need to parse: { "Person" : { "id" : "2" }, "Dog" : { "dateOfBirth" : "2012-08-20 00:00:00", "price" : "10.00" } } I need to convert this…
Noam
  • 3,049
  • 10
  • 34
  • 52
8
votes
8 answers

JPA best practices?

I’m working on a little multi-tier application utilizing JPA/EclipseLink as a persistence layer. In my current design I have two sets of objects, POJOs and Entity objects, I use POJOs for general programming tasks and Entity classes are used for DB…
Hay
  • 81
  • 1
  • 2
8
votes
1 answer

Jackson error: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token

Hey I have also problem here is my Json [ { "aimid": "12345" }, { "aimid": "333674" }, { "aimid": [ "4568999", "6789345" ] }] and This is my Pojo class:- @JsonProperty("aimid") private String aimid; public String…
Deepak Kumar
  • 83
  • 1
  • 1
  • 8
8
votes
5 answers

Convert JSON into POJO (Object) similar to android in Flutter

I'm just trying to find a way to convert a json response (from a REST API) into POJO (As used in android) so that I can use the received data into my application as using Map wont be sufficient as the data i'm receiving is a little complex and…
Jaswant Singh
  • 9,900
  • 8
  • 29
  • 50
8
votes
2 answers

Defining a default constructor and a secondary constructor in Kotlin, with properties

I'm trying to make a simple POJO (POKO?) class in Kotlin, with a default empty constructor and a secondary constructor with parameters, that feeds properties This doesn't give me firstName and lastName properties: class Person() { …
MPelletier
  • 16,256
  • 15
  • 86
  • 137
8
votes
2 answers

Converting a POJO to XML

I have to make a SOAP POST request as below POST /sample/demo.asmx HTTP/1.1 Host: www.website.org Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "https://www.website.org/Method"
Logic
  • 2,230
  • 2
  • 24
  • 41