ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

Difference between DTO, VO, POJO, JavaBeans?

Can you also explain the contexts in which they are used? Or the purpose of them?

user-image
تم إضافة السؤال من قبل Mohamed Mansour , Java Developer , Arrow Electronics
تاريخ النشر: 2013/06/11
Bassem Zohdy
من قبل Bassem Zohdy , Senior Software Architect , HelpAG

the difference manly in terminology and definition but it is very close terminologies, DTO, Data Transfer Object used to transfer collection of data across application layers.
VO, Value Object is also container of values in one object to be transferred between application layers so DTO and VO are almost the same but it is used in different places for ex, DTOs are often used in conjunction with data access objects to retrieve data from a database, VOs are often used in conjunction with presentation and integration layers.
POJO, A Plain Old Java Object is a term initially introduced to designate a simple lightweight Java object which do not need specific container "like web or EJB container" to run it.
JavaBean, is a class that follows the JavaBeans conventions as defined by Sun:1-The class must have a public default constructor.
This allows easy instantiation within editing and activation frameworks.2-The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention.
This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.3-The class should be serializable.
This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.
so the4 terminologies could be used to point to the same thing most of time, but it depends on context you are mentioned it in: when talk about getting data from repository you are using DTO when talk about transfer values between layers you are using VO when talk about object used without need for any specific container you are using POJO when talk about the JavaBeans conventions mentioned above you are using JavaBeans check this link too http://stackoverflow.com/questions/1612334/difference-between-dto-vo-pojo-javabeans

Angelo Endaya
من قبل Angelo Endaya , Maximo Application Developer , IBM Solutions Delivery Inc.

I regularly used POJO(Plain Old Java Object) it is a java class that very usefull in my simple web project you can call this POJO in BIRT reports, JSF, JSP.xHtml. Try to visit my website I used POJO there in Google Maps, Charts, BIRT reports.  http://angeloendaya.appspot.com/

المزيد من الأسئلة المماثلة