Solved

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

Posted on 2013-11-22
5
3,063 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 500 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

707 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