?
Solved

BO(business object classes) vs VO(value object classes) in java

Posted on 2013-11-22
5
Medium Priority
?
3,273 Views
Last Modified: 2013-12-02
Hi,

I see  AbcVendor.java is under the vendor-org-bo package.(i think it is business objects)

When I see AbcVendor.java code it like as below  
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;


/**
 * The persistent class for the vendor_organization database table.
 *
 */
@Entity
@Table(name="vendor_aaa_organization")
//@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)

public class AbcVEndorBo implements Serializable {

	@Column(name="VENDOR_PRICE_CHECK")

	private String vendorPriceCheck;

	public String getVendorPriceCheck() {
		return vendorPriceCheck;
	}

	public void setVendorPriceCheck(String vendorPriceCheck) {
		this.vendorPriceCheck = vendorPriceCheck;
	}

Open in new window



with its getter and setters. There are bunch of other fields also with getters and setters.



There is also AbcVendorVO .java under vendor-org-businessservice package which has exactly same fields( without column names)  and again their getters and setters.

import java.io.Serializable;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AbcVendorVO implements Serializable, Cloneable {

private String vendorPriceCheck;

	public String getVendorPriceCheck() {
		return vendorPriceCheck;
	}

	public void setVendorPriceCheck(String vendorPriceCheck) {
		this.vendorPriceCheck = vendorPriceCheck;
	}

Open in new window


My question is are we using both Business object and Value object design patterns in my code. I wonder why we need same getters and setters in both places.

why the 'AbcVendor.java' is under vendor-org-bo package.(business object package which seems to me plain hibernate mapping file).

Why AbcVendorVO.java is under vendor-org-businessservice package ?

Is this kind of structure is same in any kind of organization?
is there is a good book or link which tells me clearly differces between these confusing terms like 'businesss objects', 'value objects', 'business services', 'bo', 'vo' etc jargon
please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Sharon Seth earned 2000 total points
ID: 39676733
In many cases , a Value Object is same as the DTO(Data transfer object) . In your case , ABCVendor.java is the business object(BO) i.e, the actual business entity object . This is the class that represents your real world vendor . This is what gets persisted to the DB .
ABCVendorVO.java is like a DTO . It will be used across the application as a vendor , but finally is used to populate the BO . DTO merely is for transferring data from one layer to the persistent entity.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39678756
>>>ABCVendor.java is the business object(BO) i.e, the actual business entity object . This is the class that represents your real world vendor . This is what gets persisted to the DB .


It makes more sense. ABCVendor.java is the business object(BO) i.e, the actual business entity(i am assuming database entity tables) object

>>DTO merely is for transferring data from one layer to the persistent entity.

Do we need separate VO/DTO for transferring data across UI to persistence entity(which is BO right)??

We are using the JSF2.0 with primefaces for front end and have bunch of managed bean classes also. So managed beans pass the data to VO/DTO which in turn pass it on to BO class. where i can read more about these internal working which are not so obvious to me.

Please advise
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 39679910
That's what a DTO is for . Whether we need DTO or not depends on the context . You can just google for DTO for more info/reading , but it's only when you pick a couple of already implemented projects online  and start analysing them that you can actually relate to what you have read . SO , I suggest pick a good project on sourceforge and analyse it.
0
 
LVL 7

Author Comment

by:gudii9
ID: 39681518
but it's only when you pick a couple of already implemented projects online  and start analyzing them that you can actually relate to what you have read . SO , I suggest pick a good project on sourceforge and analyze it.

can you please point me to good 'already implemented online projects'

I searched on Google with key word 'sourceforge implemented java j2ee projects'

i do not see much relevant links there.

Not sure how to search/use/look for old projects in sourceforge for 'already implemented online projects' as i never used it.
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 39683213
I meant , there are some java frameworks out there  which are considered to be 'good' and efficient as a result of good design . Pick up anything randomly . Go for hibernate if you like.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question