I started learning MVC with spring. I have heard lot of time Bean
, that contains setter and getter. Model
is basically what data flows around, and Pojo
which is same as Bean
. But I am really confused in all this term and all this look same to me can you please explain the exact difference among all of them.
JAVABEAN
POJO
MODEL
If you're using the MVC architecture then the Model represents your domain: means your entities and it's not a java related term.
Your Models are represented in Java as Java Beans (best practice in Java EE).
A Java Bean is a normal Java class which implements the Serializable interface and have a parameterless constructor and have getters and setters for each field.
However POJO is just a denomination for objects not bound by any restriction other than those forced by the Java Language Specification (Wikipeadia). This is just for conventions sake and it's not strictly related to the MVC architecture.
Note that Java beans are POJOs implementing the Serializable interface.