Understanding JAVABEAN EJB POJO

"Spring real" Chapter One: basic concepts, all kinds of names sayings 
POJO (Plain Ordinary Java Object) simple Java objects, is in fact an ordinary JavaBeans, EJB and to avoid confusion created by the abbreviation. 
POJO name used to avoid confusion and EJB together, and which more directly referred to the class attributes and methods of getter setter, no business logic, sometimes as VO. (Value - Object ) or dto (Data Transform Object) used of course, if you have a simple arithmetic attribute is also possible, but does not allow business methods, we can not carry the connection method and the like. 
The inner meaning of POJO: There are some parameters as the private property of the object, and then access for each parameter definitions get and set methods of the interface. Did not inherit from any class, any interface is not implemented, but not invaded other java object framework. 


JavaBeans: JavaBeans actually has three meanings. First, JavaBeans is a specification A Java (including JSP) technology specifications of Java components that can be reused, it can be said as we often say interface. Secondly, JavaBeans is a Java class that, in general, such a Java class will correspond to a separate .java file, in most cases, this should be a public type of class. Finally, when a Java class is instantiated such JavaBeans in our specific Java program, this is what we object-oriented object, we may still have one such example, JavaBeans called JavaBeans. In short, it is in Java interfaces, classes and objects. 
Its method name, structure and behavior must conform to specific conventions :: 
1 , all property is private.
2This class must have a public default constructor. I.e., no parameters are provided constructor.
3 , the class attribute getter and setter access to use other methods to comply with standard naming conventions.
4 , this class should be serializable. Implement serializable interface. 
Because of these requirements mainly by convention rather than by implementing the interface, so many developers to follow specific naming convention JavaBean seen as the POJO. 

JDO (Java Data Object) is a new Java object persistence specification, is a standardized API for accessing some of the objects in the data warehouse. 

EJB 


serialization and deserialization Serializable 
if an instance variable declared transient, when the object is stored, its value need not be maintained. In other words, it is with transient member variables keyword tag is not involved in the sequencing process. 
Static static properties are not serialized. 
serialVersionUID: then correlation is serialized Java calculated based on the model attribute. (Time and then implement the Serializable interface, serialVersionUID must give this assignment, you can set 1L) 
class by implementing the java.io.Serializable interface to enable its serialization function. 
Class does not implement this interface will not make any series or deserialization. 
All subtypes sequences can class are themselves serializable. Since implementation of the interface is indirectly equivalent to inherit. 
Serialization interface has no method or field, only to identify semantic serializable. 

About serialization and de-serialization article: HTTPS: //blog.csdn.net/u013870094/article/details/82765907     

POJO: Spring's non-invasive programming model means that the class can play the same role in the Spring and non-Spring applications. 
Injection dependency: 
when the configuration of the instance parameters as constructor parameter.

 

Guess you like

Origin www.cnblogs.com/geekftz/p/11274387.html