The question of the pre-specified classes is as follows:.
Plain Old Java Objects means more or less "The good old Java objects". It means a purely Java object created by you, using at most libraries already included in Java, created without any kind of particularity of external frameworks, such as the Servlets or JEE framework (EJB), which are later JDK technologies that require Java objects to have "particularities" in their declaration/implementation, such as implementing an interface or extending a specific class of the framework, which is what the text calls "pre-established class"or have certain annotations, with the intention of running on a Container. Pojos could be called "Vanilla Java Objects" that would have the same effect.
This answer explains well what they are.
I didn’t mess with JEE and I don’t remember exactly what a Java Bean Enterprise looks like, but Fowler and colleagues wanted to show in the talk that you could program without EJB, just with ordinary objects, and called these ordinary (non-JB) objects POJO, as he says here.
A domain object, such as a Pedido
or a Cliente
is a typical POJO. A Javabean is a POJO with certain particularities, but that does not depend on anything external, so it is still a POJO.
An EJB, Servlet and Hibernate entity are not Pojos, implement JDK-specific interfaces, specific annotations.
A DAO or Repository that uses Hibernate I don’t know if it’s POJO. A subclass of a Java Swing component I don’t know if it’s POJO. But it could be angel sex, and I don’t know if it’s worth arguing about. The term POJO arose as a reaction to the Java EE Ejbs, and that’s what it is, a common object that doesn’t need to be an EJB.
right, I think I understand, but as so either previously stated or already created. At some point I will create the class I want to inherit, no?
– farmac
Yes, without creating something, it does not exist and what does not exist cannot be used.
– Maniero
Okay, so the conclusion is, doesn’t Pojos inherit (extends, Mplements or receive annotatios) in any way (except Objects)? .
– farmac
At that point it’s not confused, it’s in others.
– Maniero
I understood better now, after reading Deitel
– farmac